locked
SPD - Copy list item and then update new item metadata RRS feed

  • Question

  • This may be simple to do with SPD, but I am having a brain lock trying to figure out how to pull it off.  I have two document libraries, LibA and LibB, that contain identical metadata with one exception:  LibB has an extra column used for an "acronym".  I am using a manual workflow to copy documents from LibA to LibB.  When the workflow initiates,  I prompt the user for an acronym to describe the document content.  I want to be able to copy the item from LibA to LibB and then update the acronym column in LibB with the input provide by the user at initiation. 

    I appreciate any suggestions.

     


    • Moved by Mike Walsh FIN Monday, April 18, 2011 6:17 PM This seems to be a workflow question not a customization question (From:SharePoint - Design and Customization (pre-SharePoint 2010))
    Monday, April 18, 2011 6:09 PM

Answers

  • Ming,

     

    Thank you for the response.  The information you have provided is exactly the way I have been approaching the solution.  My problem has to do with uniqueness in Lib B once the copy has been executed.  I need method to identify the item I just copied to Lib B. Is there a way to capture the ID/GUID of the item I just copied to Lib B within the workflow?

    I though about this approach, not ideal, but may be the only way with SPD.  I was going to add a column to Lib A called "Just Added Flag" and set it to Yes/No with a default of Yes and hide it.  Once the item is copied, I can identify the item in Lib B by this flag, update the Acronym and then set the "Just Added Flag" to no.  This way any old documents in Lib B would be set to No and only the item I just added would be Yes.  

    I appreciate your help.

     

    • Marked as answer by Emir Liu Tuesday, April 26, 2011 6:06 AM
    Thursday, April 21, 2011 2:15 PM

All replies

  • Hi,

    I understand that you want to use workflow to copy a document from Lib A to Lib B and give a value to the extra column in Lib B at the same time .

    Here are my suggestions .

    1 . Create a workflow and choose to Allow this workflow to be manually started from an item . Click ‘Initiation’ button and in the Workflow Initiation Parameters Dialog add a new field . Don’t set the default value for the field . It will prompt you to enter the value for the field when you manually start the workflow .

    2. Click next step and add an action ‘ copy list items’ . Set the first list as Lib A and the second list Lib B .

    3. Add the action ‘update list items’ . Set ‘this list’ as Lib B and set the extra column to have the value from the workflow data , that is to say from the initiate field .

    4. Click OK .

    5. Start the workflow manually by browse to the item and choose workflow in the drop-down list . Set the value for the initiate field and click start .

     

     

    Please let me know the results of these actions at your earliest convenience.

    Best Regards


    Ming
    Tuesday, April 19, 2011 8:53 AM
    Moderator
  • Ming,

     

    Thank you for the response.  The information you have provided is exactly the way I have been approaching the solution.  My problem has to do with uniqueness in Lib B once the copy has been executed.  I need method to identify the item I just copied to Lib B. Is there a way to capture the ID/GUID of the item I just copied to Lib B within the workflow?

    I though about this approach, not ideal, but may be the only way with SPD.  I was going to add a column to Lib A called "Just Added Flag" and set it to Yes/No with a default of Yes and hide it.  Once the item is copied, I can identify the item in Lib B by this flag, update the Acronym and then set the "Just Added Flag" to no.  This way any old documents in Lib B would be set to No and only the item I just added would be Yes.  

    I appreciate your help.

     

    • Marked as answer by Emir Liu Tuesday, April 26, 2011 6:06 AM
    Thursday, April 21, 2011 2:15 PM
  • Did you ever find a solution for copying and then updating? Your proposed answer has a certain amount of risk, if 2 people fire off the workflow at the same time.

    I tried using the Name field as the identifier, but when I try to update the list item after just copying it I get this error in the logs:

    WinWF Internal Error, terminating workflow

    System.ArgumentException: listItemKey     at Microsoft.SharePoint.WorkflowActions.WaitForDocumentUnlockActivity.Initialize(WorkflowContext context, Guid listID, SPItemKey listItemKey)     at Microsoft.SharePoint.WorkflowActions.WithKey.UpdateItemActivity.Execute(ActivityExecutionContext provider)     at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)     at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)     at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)     at System.Workflow.Runtime.Scheduler.Run()

    I don't know if there is some kind of lock placed on the file after it is created?
    Wednesday, February 13, 2013 10:13 PM
  • One way i have been able to get the update functionality is by adding an ID field to the second/destination list (Lib B).

    I was doing this in 2007 and I believe it only worked if I used the 'Create List Item', but during the item creation I would pass the ID of the original item into this new ID field in the second list and then use this for updates. Basically something like - update item in list b where refID equals current item ID.

    This would really be better suited to scenarios where you would need future updates to happen and sounds like it might help CoderMonkey09 and not deadbolt67 so much.

    I'm trying some tests with initation parameters and will report back here if I'm able to get a one-time initial update of metadata on a copy/create item action.

    Tuesday, March 12, 2013 5:25 PM
  • Ming,

    I have similar requirement to copy a list item and then open the newly created list item in edit modal window to give the user an option to edit the newly created item.

    you can find the solution in my blog:

    http://sharepointx-men.com/2013/03/13/part-i-create-new-list-item-by-copy-existing-list-item-and-then-edit-the-newly-created-list-item/

    Cheers,

    Abhijit Sil


    Abhijit Sil

    • Proposed as answer by Abhijit Sil Thursday, March 14, 2013 2:47 PM
    • Unproposed as answer by Abhijit Sil Thursday, March 14, 2013 2:48 PM
    Thursday, March 14, 2013 2:47 PM