Check if workflow is running?


Badge +6

Hi Guys,

Is there a way to check if a workflow is already running against a list item?

 

I am using a web service call to update list items by bulk every morning but it would help if I can check if the workflow is already running so that I don't run it for that item.

 

Keep in mind that the workflow run for that item everyday so I cannot check if the workflow column is null or something because it will always have something.

 

Thank you

 

Regards

 

Bhuti


10 replies

Userlevel 5
Badge +12

Hello,

How are you starting the workflows associated to each list item?  Are you able to use the workflow status column to check to see if it is "In Progress" or some other value that would you to tell that the workflow was currently in progress - I would probably do something along these lines and it could vary slightly depending on your launch mechanism.  

-Mike 

Badge +11

Yes, display the Workflow Status field in your list/library and it will tell you if it is In Progress or Complete for each list item.

If this is a scheduled workflow, you can look at the workflow history for site workflows and the one you created should have a status of complete, running or errored / canceled.

Badge +6

Thank you guys, I will check this out.

What I do is run a query list using a site workflow of the items in the list.

Then I loop and kick-off the list workflow.

What I struggled about is that if I use the workflow column and wanting to find a running workflow, do you use the words "In Progress" or do you use a number?


I noticed this before that the value in the workflow coolumn is integer.


Reegards


Bhuti

Badge +11

The Workflow Status field is automatically generated by Nintex. It is a text field. Normally when you create a workflow, it automatically gets displayed in the list view. However, you can decide to not display it.

Again, if it is a scheduled workflow you can use the 'Set Workflow Status' to change items to the status you want it to be. But when it is not scheduled this will happen automatically.

Badge +11

Try using text like 'In Progress'.

Userlevel 5
Badge +12

It'll be in your Item Property columns as the name of the workflow that is on the list.  So you can use it to get the value and make sure its not running before launching it.

Userlevel 5
Badge +12

Just checking in to see if the solution worked for you?

Badge +6

Hi Guys,

I can confirm that Nintex workflow column does not return the text "In Progress" or "Completed" etc, it returns a number but in a text type.

For example for Completed workflow it returns 5 so I just need to keep trying and find out what is the number for In Progress and Error Occurred.

So I will then use the number when to check only the items that are not running.

Regards

Bhuti

Userlevel 5
Badge +12

Hi Bhuti,

 

Here are the codes you are looking for:

 

NotStarted = 0

FailedOnStart = 1

InProgress = 2

ErrorOccurred = 3

StoppedByUser = 4

Completed = 5

FailedOnStartRetrying = 6

ErrorOccurredRetrying = 7

ViewQueryOverflow = 8

Max = 15

 

Thanks,

Mike

Badge +6

Thank you very much. This will help a lot I will keep this in my local blog.

Reply