A common SharePoint customization request is to copy or move items and documents between lists. This can be accomplished without development by creating a workflow using SharePoint Designer (SPD). With this approach, you may encounter issues with list item fields not copying or copying intermittently. This article will explain how the copy list item activity works, what can go wrong and how to troubleshoot and resolve the issues.
If you are not familiar with SPD workflows, here is a quick primer on how to create a workflow that copies a list item to another list. Open the site and select File > New Workflow. Select the source list and set the start options. Note in this example, the workflow executes when a new list item is added.
The workflow consists of steps which have conditions and actions. In this example, there are no conditions, only an action to copy the list item:
Configure the action to copy the current item in the source list to the target list and click Finish to associate the workflow with the source list.
Add a new item to the source list and you can see the outcome of the workflow:
The item was copied to the target list:
The copy list item activity iterates through all the fields in the source list and tries to find a match in the target list. The fields are considered compatible for copying when the following is true:
After the field matches have been determined, a list item is created in the target list using a system update (does not trigger event receivers / workflows and the created by user is system). In addition, when the field type is User, the user(s) are created in the target web if they don't already exist.
There are two common symptoms and the underlying causes of each is human error. But don't beat yourself up; they are easy mistakes to make and correct. Use the following to troubleshoot the issue:
In a document library, users can add a document two ways through the browser. The first option is to click New. This opens the client application associated to the list template such as Microsoft Word. In Word 2007, the list item properties appear on the Document Information Panel (In Word 2003, the list item properties are displayed in a dialog when you save the document):
Because the list item properties are captured by the client application, the document and properties are saved at the same time. The save triggers the workflow created event receiver logic and the copy will succeed. When the document is added using the Upload (or Upload Mutliple) option, the upload occurs in two stages. The first stage is adding the file to the document library:
The second stage is updating the list item properties. At this point, the item has been added to the document library, the created event has fired, and the copy list item workflow has completed. The properties haven't been entered, so the workflow copied the document and blank property values to the target list.
The following summarizes the differences between New and Upload:
To overcome the issue with document libraries, one possible approach is to modify the SPD workflow as follows:
SPD workflows are a business-user enabling technology and a useful tool in your SharePoint customization toolkit. I hope this article sheds some light on how to implement a copy list item workflow using SPD and how to troubleshoot and resolve common issues with the approach.