Prevent multiple workflow instances from running on conditional start


Badge +2

Hello

I am using Nintex Workflow 2010 on a multi-server SharePoint 2010 farm.  I have seen this problem many times and am wondering if there is a method to avoid encountering the issue.  I have a list with an InfoPath 2010 customized form attached.  I have a workflow on the list which runs conditionally when the item is modified.  The condition uses a calculation like 'State (previous value) not equals State'.  When the form is updated and the state changes, the workflow will get kicked off multiple times (not necessarily consistent, could be 2 or 3 times).  I have been able to workaround this issue by adding a Pause at the start of the workflow.  A Pause will ensure that only one instance runs.  However, I keep having to do this and I don't want all these delays.  I would really just like to figure out why the workflow is getting kicked off multiple times in the first place.

Thanks for any help that you may be able to provide. 


14 replies

Userlevel 6
Badge +16

So as to get more clues, I suggest you to add a "Log History List" action so as to collect data as:

-Current time

-State

Perhaps you could find different data and analyze it.

Userlevel 5
Badge +12

Hello,

I know you said that you didn't like adding the pause to the start of the workflow, but check out this great post by Aaron that explains the benefits of doing this:  Defensive Workflow Design Part 4 - Slow Down and Speed Up

Thanks,

Mike

Badge +11

Is this condition also set on the 'When item is added'?

Badge +2

Workflow Settings:

Start When Items are Created = Yes

Start When Items are Modified = Conditional

Condition (as shown below)

Nintex_ConditionalStartCondition.jpg

On change of existing item, looking at the workflow history for the item, I see two instances of 'Handle State Change' workflow are run with the same 'Started' timestamp (3/19/2015 8:59 AM)

Nintex_DuplicateWorkflowHistory.jpg

I added a log entry that shows the value of the 'Status' field which the start condition depends on and the results are as follows:

Log Entry from First Instance:

Nintex_FirstInstanceLogMessage.jpg

Log Entry from Second Instance:

Nintex_SecondInstanceLogMessage.jpg

Badge +2

When I first noticed this problem on this particular workflow, it wansn't set to start on item created, however, I changed it since then so that it is started on creation as well.  The problem of duplicates isn't when the item is first created but rather when it is modified.

Badge +11

It is making me wonder. I'd definitely have a log action in there to see if it is getting kicked off when you add an item.

Badge +2

As you can see, the workflow does run when the item is created, then, 10 mintues later, when I change the item, that is where the workflow is initiated twice.

Nintex_FullWorkflowHistory.jpg

Userlevel 6
Badge +16

Have you the change of blocking this current workflow and export/import a new workflow?

Badge +11

I've instances before where I had 2 workflows and they were running twice. I was using SharePoint with Nintex. The only way I'd be able to see both workflows was through SharePoint Designer. I couldn't see it in the workflow gallery or the list of workflows. That could explain why it is running twice too.

Badge +2

I hadn't ever looked at the Nintex Workflows in SharePoint Designer but assuming you just open the site and click on the 'Workflows' object in the navigation page, I don't see any duplicates listed there.  I can see all the workflows that are setup on my list and site but I don't see any duplicates listed there. 

Badge +2

I am not quite sure what you are asking but I havn't ever exported or imported this workflow.  I am not sure what you mean by blocking?

Userlevel 6
Badge +16

How to remove or block a Workflow on Office 365

Badge +11

When  you export a workflow, its a way to save it locally on your PC and import it into another site. You can also just insert back into the same location. But you have to make sure you have all the lists, fields, etc that the workflow references. Importing it simply allows you to bring another workflow back into a site. So basically you don't have to create it from scratch. There are Export/Import buttons in the workflow designer at the top. It will allow you to save the workflow anywhere you want on your PC. Delete the workflow in your site and then import it.

Userlevel 5
Badge +12

Are you using "Update Item" or "Set Field" actions within your workflow?   If so, I have seen these actions actually cause the workflow to launch itself again (considering the item is being modified). 

Thanks,

Mike

Reply