It’s possible to cause an endless loop in a SharePoint Designer workflow. A common implementation pattern like this causes the problem:
- Create a workflow and associate with a list.
- Indicate that it should start on create of new items and update of existing items.
- A step in the workflow updates a field in "Current Item".
- Since the current item changed, the workflow starts anew.
To prevent this endless loop, implement a simple semaphore:
- Add a site column (or column to the list/library if you’re not using content types).
- Hide it from the edit page (easy to do if a site column via its properties, not as easy if a list column).
- In the workflow, check to see if the value of the semaphore column is blank.
- If it is blank, set it to a non-blank value and proceed.
- If is is not blank, exit immediately.
This can become a fairly nuanced solution, depending on business requirements and so forth, but it’s been a workable pattern when I’ve needed it.
</end>
Subscribe to my blog.
Like this:
Be the first to like this post.
To take this suggestion one step further –
I created a separate custom list called Notifications and created a column for each workflow I have. I was having trouble when sending emails – causing a loop – and mail bombing my inbox. So now, I have the workflow check the status of the column (of the same name) BEFORE the email is sent, and then change the value AFTER the email is sent.
Maybe I\’m missing something here, but that seems to work the first time, but never again.
When you set the field to Non blank, it will exit the secone time its called. That\’s good.
But when you update the item, say 15 min later, then the field is still set to non blank, thus, it exits without running the workflow… am I missing something.
I hope I am, as I need to work.
As an FYI, I have a less elegant solution.
Rather than setting a flag on the item itself, I create an entry in a new list. Then the second time through, I delete it. That acts as the flag, but I would like a more elegant solution if possible.
Paul,
Please responsd to this. Does your solution work if the the list item is edited more then one time?
ショッピング枠現金化するので誰でもかんたんにカードでお金をおつくりできます♪ご融資などではありませんので審査や面倒な手続きは一切ございません! ご返済方法は一括・リボ・分割(最高20回)・ボーナス一括などからお選びいただけます。