How to determine if a version of a SPD workflow is already running?

Category: sharepoint 2010 customization

Question

Stunpals on Tue, 05 Nov 2013 21:58:17


I have many workflows that start on change which are currently running fine. The issue is when I modify the workflow, I end up with multiple copies of the workflow (previous & current versions) running. Is there a built in value that I can use as a condition so new instances of the workflow can be stopped?

My other option is to use/update a field eg [WF-01]=Running and read that when new instances of the workflow start but I am assuming there is a better way that is built in?


Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.

Replies

Stunpals on Wed, 06 Nov 2013 16:50:50


Amit's comments describes our scenario, a workflow that starts on change will launch another instance if that workflow has been modified. Which is what I described in my original posting but the link doesn't offer any resolution to the problem.

Is there a way to manage new instances of a changed workflow. I know you can go into the lists workflow settings and manage which versions of the workflow can start new instances but this does not help this scenario.

I was hoping that there was a built in column or value that a workflow could look up to see if there is another instance of an older (previous) version of this workflow running, similar to how it will not allow multiple instances of the same verion of the workflow to run.

cubalex on Tue, 10 Jun 2014 07:10:52


Hello

I have exactly the same problem, anyone could help?

Thanks

Alex

Stunpals on Tue, 10 Jun 2014 14:52:26


It seems very strange that there is no built in way to prevent multiple instances of a changed/updated workflow that starts on "Change".

I have not tried this but at this point it seems like I may need to resort to manually managing workflows that start on change to avoid multiple instances after a change, as I stated in my original posting. Can someone tell me if they see an issue with this approach?

  1. Create a column to track if a workflow is running, eg WF01 or Named to reference the WF you want to track, with values Running & Completed.
  2. Somewhere near the top of the workflow add a condition to check if the value of WF01 is Running?
  3. If FALSE add an "update/set item" to set the value of WF01 to Running
  4. At the end of your workflow add another update to set the value of WF01 to Completed

NOTE: Sad I have to do this manually because it does cause 2 additional changes to the list item and if there are other workflows that start on change, this will trigger them 2 more times so additional logic may need to be added to these other workflows as well.


Stunpals - Disclaimer: This posting is provided "AS IS" with no warranties.


dswaving on Wed, 01 Mar 2017 18:41:44


What happens when they manually stop the workflow. How would you set the WF01 variable?

Stunpals on Wed, 01 Mar 2017 21:10:54


Agreed, and it was hypothetical scenario and I didn't actually create it. And it just shows that this is a flaw in process or there should be a way to check if it is running before launching another, newer version of the workflow.