none
SharePoint Designer 2010 Workflow; Copy List Item

    Question

  • I am using SharePoint Foundation 2010 and Designer 2010. I currently have a custom
    workflow created that gathers "Approval" from 2 groups of users. Upon
    successful approval from both parties, the workflow status goes to completed
    and sits in the library. Since this is a frequent process, there are around 20 documents
    being added to this library every day.

    I would like to add the Copy List Item and Delete Item actions to move a file with
    status "Completed" to another document library. My attempts so far
    have not worked and I’m not sure what I’m doing wrong. Any help would be
    greatly appreciated.

    Thanks!


    • Edited by Matthew767 Monday, December 10, 2012 4:29 PM
    Monday, December 10, 2012 4:28 PM

Answers

  • Hi Mattew767,

    Please see below image.

    And let me know if there is any unclear.

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Marked as answer by Matthew767 Tuesday, December 18, 2012 2:34 PM
    Tuesday, December 18, 2012 2:47 AM

All replies

  • Hey Matthew,

    is the destination library placed in another web (different site collection, subweb, sub-subweb, ...)? If so, the moving of List Items into this other library does not work with the default Copy List item activity (whereas "Delete Item" of course works fine) as far as I know.

    Anyway, what you may try is to create a second workflow, which is triggered, everytime a list item changes. Within this workflow you might check, whether the item's status has changed into "Completed" and if so, copy this item into the destination library. If the problem with the copying into another web or sitecollection then exists, the problem resides in this activity.

    You may also write an informative message to the workflow history in order to find out, to which step of your workflow you come, until it "starts, not to work", e.g. write "Step <XYZ> finished" after every step. I just tried it on my dev-machine and it works fine. The destination library does not even need to keep all of the fields, that the "source item" keeps. It just needs to be a document library. Keep in mind, that the workflow settings should forbid that the workflow can be manually triggered and that it has to start every time a list item is changed.

    Best regards!

    Peter

    Monday, December 10, 2012 6:36 PM
  • Hi Peter,

    Thanks for the reply. The destination folder is a document library on the same site. So
    for example, I have a page with libraries 1 and 2. I’m trying to add to my
    workflow to take a completed file from library 2 and move it to library 1.

    I attempted to create another workflow in the destination library and I think I may be
    missing a few lines of code. Here is the setup of my current workflow:

    Step 1

    Collect Supervisor Approval from Supervisors Group(Output to Variable: collect)

    then Log Approved by Supervisor to the workflow history list

    Step 2

    If Variable: collect equals Approvel

              Set content approval status to Pending with Awaiting Director Approval

    then Collect Director Approval from Director(Output to Variable: collect1)

    then log Approved by Director to the workflow history list

    Step 3

    If Variable: collect1 equals Approve

              Set workflow status to Approved

              then Copy item in Shift Reports to Completed Shift Reports

              then Delete item in Shift Reports

    The last two strings are were I’m experiencing my problem. The Shift reports Copy item asks for a "Field" and "Value" which I have properly filled out (to the best of my knowledge). I’m not quite sure which action to add to
    complete the task.



    • Edited by Matthew767 Monday, December 10, 2012 8:59 PM
    Monday, December 10, 2012 8:57 PM
  • Did you select Current Item for Copy and Delete action? If not try changing your last two actions to

    then Copy item in Current Item to Completed Shift Reports

              then Delete item in Current Item


    Amit

    Monday, December 10, 2012 9:20 PM
  • Hi Amit,

    Yes, I did try to use Current Item but after the workflow was complete, the document would not move. It simply stays in the original location with a Completed status.

    Monday, December 10, 2012 9:49 PM
  • I just created a simple workflow which will logs to history list on start then copy current item to another list and delete the current item and finally log to history list that the workflow is complete. It worked fine. No issues.

    Can you please try changing your If condition so that it is always true and please log something in history list before copy and after delete and see what happens. I think your IF condition might not be true when workflow is trying to process that step. Or try using Wait for Field change in current Item action before your IF condition.


    Amit

    Tuesday, December 11, 2012 3:36 AM
  • Unfortunately, my programming experience is limited but I believe my IF condition is true. I have added the History logs after each step. I published this workflow and attempted to push a couple documents through the workflow but they stopped at the same place. I left it alone for a little while thinking that maybe it needed time to copy and delete but 3 hours later it was still at the same spot. Here is the tail end of the workflow I edited yesterday.

    If Variable: collect1 equals Approve

         Set workflow status to Approved

         then Log Workflow Approved to the workflow history list

         then Copy item in Current Item to Completed Shift Reports

         then Log Item Copied to the workflow history list

         then Delete item in Current Item

         then Log Item deleted from original location to the workflow history list

    I believe the IF condition to be true because I have the value set to Approve. So once the Director selects Approve and completes the task, the workflow sees that Variable: collect1 has Approve for a value.

    It seems that I'm missing something very simple and I would be interested to see how you programmed your workflow to work. I bet we would be able to pick out the missing link that way.

    Wednesday, December 12, 2012 3:00 PM
  • Hi Mattew767,

    Collect Director Approval from Director(Output to Variable: collect1)

    The workflow variable: collect1 will return the ID of the task item that the Collect data action created. So it is an integer and will never equals “Approve”.

    So, please modify the condition to

    If [Association: Task List: task form field you created in Director Approval  action where/find ID = variable: collect1] equals Approve

    Let me know if you have any question.

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Proposed as answer by Kalai_ Tuesday, December 18, 2012 3:56 AM
    Thursday, December 13, 2012 6:19 AM
  • Ah I see now. So it appears that my IF condition is in fact "False" as the previous gentleman stated. I also see know that the beginning of my second step is also "False" and is not working. The immediate progression to the next "Action" effectively hide that detail. So now with this information, I have attempted to make the following changes in the Define Workflow Lookup window for the first "Value" in step 3.

    Data source: Association: Task List

    Field from source: Approval 2 ( this is the approval task from Director Approval)

    Then, under Find the List Item, I have "Field" and "Value" options. I think I may be misunderstanding the tail end of your instructions. Are you referring to a "Field" named "Find ID"? I looked and did not see that as an available option.

    Again, thank you all for your help. I have a feeling I'm getting close to the resolution. 

    Friday, December 14, 2012 4:53 PM
  • Hi Mattew767,

    Please see below image.

    And let me know if there is any unclear.

    Thanks & Regards,
    Emir


    Emir Liu
    TechNet Community Support

    • Marked as answer by Matthew767 Tuesday, December 18, 2012 2:34 PM
    Tuesday, December 18, 2012 2:47 AM
  • Fantastic!! 

    That did the trick. I just needed the visual to see what I was doing wrong. Thank you all for your help!

    Tuesday, December 18, 2012 2:34 PM
  • Emir,

    Is there anyway to do this without user input? I mean can I get the "Approve" from the field in the list and have the item copied based on a value that is in a choice "dropdown" column?

    I have a scanning queue for doucments which is a "limbo" library, no docmuents will stay in this library they are moved based on a "Document Type" choice column. A user will go in the Edit Properties on the document and change the document type field and when they hit save I would like a workflow to copy/move it to the correct directory. I like the solution up above and its works but I would have to create a seperate document type drop down for just the task. it would be great if the workflow could read the document type in the properties and use that to assign it to the correct library with in the site without assigning abunch of tasks.

    Thank you,

    Colby 


    Tuesday, October 15, 2013 7:57 PM