7

In SP Designer 2013 I have created a List Workflow that runs when a new Item is created.

I am trying to make it generate a copy of the List item (into the same list)

However, it reports an error that it can't do this because copying the item would trigger the workflow again and create an infinite loop.

Can I make it so the workflow only triggers when a user creates a new list item? Or is there another way to get this to work?

Or, can I set something like a static variable so that it only triggers once?

2 Answers 2

7

It is a valid case Microsoft has considered.. SP Designer won't let you create item in same list from a workflow if it executes on item create event.Reason being it will go in infinite loop.

Follow this approach: 1) In Original list create a hidden column for you reference. Say Yes/No column

2) Create a temporary list say "Temp" Create 2 columns. OriginItemID : Type Number Copied : Yes/No default to No

3) Now in your original list workflow Copy current item ID and store in new Temp list say under 'OriginItemID' column.

4)Create a workflow on Temp list (To be run on item created only). Set Yes to Copied column

5)Create another workflow on this Temp list(to be run on item modified only) which will copy Item from Original list based on OriginItemID column of its item. And make a copy of it in original list..along with it provide No value to the Yes-No column. .Make sure this block gets executed when Copied column is Yes Once copy is created, make Copied column value to No.

6) In original workflow at the initial put condition if (hidden column is Yes) then only execute remaining code.

11
  • Thank you! This sound like an awesome method..... however, I seem to be running in to a problem where new items created from a workflow do not trigger "new item" workflows, reported here: social.msdn.microsoft.com/Forums/sharepoint/en-US/… Dec 19, 2015 at 20:29
  • If you create item in different list then workflow on that new item will trigger only if it doesn't create another item in previous list.. Like a loop back.. A -B -A
    – Gaurravs
    Dec 20, 2015 at 17:56
  • Excellent, hence your recommendation to create the additional workflow on "item edited only". Dec 20, 2015 at 19:06
  • how to implement step 3**(Now in your original list workflow Copy current item ID and store in new Temp list say under 'OriginItemID' column.)** within sharepoint designer
    – Madhav
    Jun 13, 2016 at 12:34
  • In SPD you have create a list item activity. Use it to create item in new list (Temp).. And while assigning value to 'OriginItemID' use value of Current Item Id
    – Gaurravs
    Jun 13, 2016 at 17:26
2

Create a hidden column who's value is set by the work flow. Then check if the value is null before creating a new one.

Otherwise impersonate and if the item is created by system stop the workflow

1
  • Can you explain? Currently SP designer won't let me use the "create list item" action when the trigger is auto on creation. Dec 19, 2015 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.