Learn more about SQL Server tools

mssqltips logo

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Scripts          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories


SharePoint Designer Workflow issues - Multiple emails

By:   |   Updated: 2011-06-16   |   Comments   |   Related: > 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 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.

Next Steps

Last Updated: 2011-06-16

get scripts

next tip button

About the author

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 

Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.


Learn more about SQL Server tools