Welcome to EMC Consulting Blogs Sign in | Join | Help

Paul Galvin's Blog

Use Semaphores in SharePoint Designer Workflow to Prevent Endless Loops

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>

Technorati Tags:

Subscribe to my blog.

Published 23 April 2008 20:07 by Anonymous
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Jimmy CrackCorn said:

You're moron.  What the point of having it fire on both create and modify if your "solution" only allows one modification?  

December 11, 2008 18:14

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems