SharePoint Designer Workflow issues - Multiple emails

By:   |   Comments   |   Related: > SharePoint


Problem

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.

Solution

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:

problem1

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 12.0.0.6421 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
solution1

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"

flag

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.)

flag

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

flag

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.

flag
Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Ved Mishra Ved Mishra

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips



Comments For This Article

















get free sql tips
agree to terms