Freigeben über


SharePoint Designer Copy List Item Workflow Activity Does Not Copy All Fields

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.

About SPD Workflows

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.

Define your new workflow

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:

Copy List Item Step

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.

Configure Copy List Item Activity 

Add a new item to the source list and you can see the outcome of the workflow:

Copy List Item Source

The item was copied to the target list:

Copy List Item Target

How the Copy List Item Activity Works

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:

  • The source and target field names are the same.  It compares the field name you see in the browser (SPField.Title), not the internal/static name (SPField.InternalName)
  • The source and target field are the same type
  • The source and target fields are compatible.  For example, if the source field allows multiple selections, but the target does not, or the source allows selecting people and groups, but the target only allows selecting people
  • When the source field is a lookup to another list, the target field must use the same list
  • The source field is not read only
  • The source field is not a special field, such as ContentTypeId

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.

What Can Go Wrong

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:

  • When a SPD workflow doesn't copy one field to the target list:
    • The field names don't match
    • The field names match, but the field type and the settings do not 
  • In a document library, when none of the fields are copied (except the file name), or when all the fields are copied but intermittently:
    • The issue is that everything is working as designed and the workflow hasn't accounted for it!  There is a difference between New and Upload 

The Difference Between New and Upload in a Document Library

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):

Document Information Panel

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:

Upload Document Stage 1

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.

Upload Document Stage 2

The following summarizes the differences between New and Upload:

  • When a document is uploaded using New, there is only a create 
  • When a document is uploaded using Upload, there is a create when the file is uploaded and an update when (and if) the properties are updated--but the properties are updated with a system update so the update event does not fire

Troubleshooting and Solutions

  • When only one field doesn't copy
    • Don't trust your eyes, copy the field name from the source list and paste it into the field name of the target list.  For example, how long does it take you to spot the difference between these two fields:  Source:Mutiline Field, Target:Multiline Field?
    • Compare the settings between the source field and target field.  Does one allow multiple values and the other does not?
  • In a document library when all fields don't copy or copy intermittently
    • The workflow needs to account for the difference between New and Upload
      • Configure the workflow to execute when the item is changed
      • Add a condition to the copy list item step to examine the workflow status

To overcome the issue with document libraries, one possible approach is to modify the SPD workflow as follows:

  • Set the workflow to execute only when the item is created
  • In the first step, add a wait activity to wait until a required field is not empty (a field that is entered in the "second  stage" after the document is uploaded)

Conclusion

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.

Comments

  • Anonymous
    January 02, 2009
    PingBack from http://www.codedstyle.com/sharepoint-designer-copy-list-item-workflow-activity-does-not-copy-all-fields/

  • Anonymous
    July 06, 2009
    Nice article! I was wondering if there's anyway to copy a object to a list on another site? Thanks

  • Anonymous
    July 31, 2009
    John, This is all well and good but when selecting a start option to 'automatically start workflow when new item is created' causes a workflow error when using Copy List Item. I have had limited success using 'Set Field in Current Item' but this only copies one field of data even tho I have actions to copy 4 fields. Copy List Item does not seem to work with 'automatically start workflow when new item is created'. Any ideas? TJ

  • Anonymous
    January 26, 2010
    The comment has been removed

  • Anonymous
    July 07, 2010
    There are some custom actions online that give you options to move or copy a item from library to library using URL string.

  • Anonymous
    February 17, 2011
    Great article. But can we move item from one list to different list in different sub site in the same site collection? In SPD I don't see the subsite list while creating the workflow. I could sucesfully move item from one list to anothere in the same site. Any pointers would be helpful. ekhichdi.com/.../Remove-Orphan-Entries-225.html

  • Anonymous
    April 06, 2011
    Using SPD work flow, I am trying to copy list attachment from list A to list B, but when I had a look in workflow report I get "unknown error", my both list are identical and field type is also exactly the same, if anyone of you have came across the same problem and found any workaround or the cause of this error please share with me. Thanks, Nishikant Madghe

  • Anonymous
    July 10, 2012
    I want to copy one item form document library properties to a list with SPD Workflow but I get an error that says. The column should be identical. Do you have any idea?

  • Anonymous
    February 10, 2013
    I am using a column whihc has a Name presence field.  I want it copied when a user enters in a person's name to the field, and copy it to all records where the project number is the same.  It does not want to copy it.

  • Anonymous
    July 17, 2013
    Great article!  Used it today with one of our international customer.

  • Anonymous
    November 09, 2014
    I've one list "A" with columns ID, ID_1. One more list. Test_1. My requirement is when a item is created in Test_1 that should reflect the item ID in ID_1 of list "A". It should only update the ID_1 Column , not entire list "A". How I can achieve this in 2013 workflow ?