cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How to terminate the previous instance (same version) of the workflow on an item?

Here is my requirement:

User X makes a change to a list item and submits the item for approval. However, before the approval workflow is complete, User X realizes that he needs to make some more changes. User X goes back to the item (which was in 'Pending' approval status) and makes his changes and makes a second approval request.

Currently, this second approval request by User X is not starting a new workflow instance (if previous one is not complete, as is the case here). I have tried using the "Terminate Workflow" action with "Cancel all other workflows" configuration (as per the Nintex documentation, this is supposed to cancel all previous instances of the workflow on the item) but it is doing nothing.

Interestingly, if you modify the workflow design (that is create another "version" of the workflow) before making the second approval request, then the "Terminate Workflow" action cancels the previous instance (which is now an older "version") of the workflow and the approver gets an email that "Approval is no longer required" on the first change.

However, I am looking to cancel the previous "instance" of the workflow (regardless of the workflow design versions) when changes are made while approval is pending.

Seems like we should be able to do this. The OOTB SharePoint workflow appears to do this easily.

Any suggestions will be highly appreciated. 

Thanks.

Tags (1)
0 Kudos
Reply
6 Replies
Workflow Hero

Re: How to terminate the previous instance (same version) of the workflow on an item?

you can run just one instance of a workflow on an item.

so if you want the same workflow is executed on item change event as on new item event (ie. one that is already running), then it's simply not started hence can not execute terminate workflow action.

create one another workflow that will run on item change event and let terminate workflows from this extra workflow.

Accept as Solution Reply
Workflow Hero

Re: How to terminate the previous instance (same version) of the workflow on an item?

As the approval has not been made yet I wouldn't even necessarily see a new workflow start. Ones the approver gets to approve the element he will just see the latest version of the item to approve.

If you really need to interact, then you could have a second workflow that runs when the item is updated AND the approval workflow is running. That workflow could notify the approver that the item to approve had been modified or even restart the workflow. But personally - without knowing your scenario - I would just let the first workflow run.

Accept as Solution Reply
Workflow Hero

Re: How to terminate the previous instance (same version) of the workflow on an item?

Enrico,

Thanks for responding. Unfortunately, in  my situation, the approver is also selected (from a drop-down list in the form) by the author . So it is possible that the first time, the author selected Approver X, but before the approval task completed, the author could decide that it should really be Approver Y. So the author could make that change on the form and resubmit. Currently, without being able to terminate the first workflow instance,  Approver Y never gets the approval request notification (as the 2nd workflow instance does not start).

Marian,

Appreciate your reply. Your suggestion is a good one but it does not seem to resolve the situation I describe above for Enrico. For example:

First Submit (item created)--> Triggers Workflow 1 and sends out an approval request to Approver X

Second Submit before Workflow 1 completed (item was changed - say a form field was updated) --> this triggers Workflow 2 (which terminates Workflow 1 as you suggested) and sends out another request to Approver X

Third Submit before Workflow 2 completed (item was changed again - say this time the author changed his approver selection to Approver Y) -- this will not trigger any workflow instance and Approver Y will never get an approval request.

Accept as Solution Reply
Workflow Hero

Re: How to terminate the previous instance (same version) of the workflow on an item?

After giving Marian's idea some thought, I think the following might work:

Create 2 workflows (Workflow X and Workflow Y).

Workflow X runs on Item Create as wells as Item Change

Workflow Y runs only when Approver field is changed (this workflow terminates Workflow X and after that performs the same actions as Workflow X)

If the author changes the item (but not the approver field), the original approver will not receive any new notification, but will be able to review the changed item.

Accept as Solution Reply
Not applicable

Re: How to terminate the previous instance (same version) of the workflow on an item?

Hi, ‌, let us know how things work out!

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: How to terminate the previous instance (same version) of the workflow on an item?

No need to implement the same logic twice.

My idea was workflow X starts on item create, workflow  Y starts on item change and first terminates running workflow then starts workflow X. Make sure workflow Y doesn't wait until workflow X ends.

0 Kudos
Accept as Solution Reply