By: Ved Mishra | Last Updated: 2011-06-16 | Comments | Sharepoint
I created a SharePoint Designer Workflow for a list. It has a step where it sends an email if the item is modified. After the workflow is fired on an item change in the list, a strange issue started occurring. It started sending several copies of the same email. Over and over.
On further investigation, I found that my server is SharePoint 2007 SP1. And prior to SharePoint 2007 SP2, a workflow on an item change will create infinite loop. The exact scenario that was happening is shown in the figure below:
In order to resolve that you could do the following. Please see figure below:
- Upgrade your server to SP2. Now this is easier said that done. Especially in a large environment this could be a month long task. But you don't need to worry if your server is already on SP2. How to check that? Anything prior to 188.8.131.5221 is not SP2. You can check the version of your server from your site itself. You don't even need to access Central Admin. Go to any of your SharePoint Sites --> Site Actions --> Site Settings (short cut URL: yoursite/_layouts/settings.aspx) and you will see the version just after Site URL and Mobile Site URL.
- Create an additional column or a workflow variable to store a FLAG value. Set this FLAG when you reach the end of workflow. Check the FLAG status at first step and then stop the workflow if FLAG is already set. See the figure below for better understanding
I will explain the steps on how to do it using a flag column. Create a column called "Flag" in the list. Ensure that the default value is set to "No"
Open the site in SharePoint Designer, expand the particular workflow and click on the XOML file to open the wizard. As you see in the figure below, the workflow starts even if the item is modified. (You don't need to follow this whole article if your workflow doesn't start on an item change.)
In first step, stop the workflow if the "Flag" value is set to "Yes". If it is set to "No" (which will be the case if workflow is running for the first time) then do your requirement specific operation. In this case, the red marked area in the figure below will contain your requirement specific logic
In last step (in this example it is the Second Step), set the "Flag" column value to "Yes" after your requirement specific logic is complete.
- Automating the Manual Start of a SharePoint Workflow
- How to implement reusable workflows on multiple lists in SharePoint 2010
- The Case of the Missing SharePoint Workflows
Last Updated: 2011-06-16