How to fire a workflow only when an item is modified

  • 2 February 2016
  • 4 replies
  • 6 views

Badge +7

Hello,

Here is my situation.

I have a list that has been created for submitting Purchase Order Requisitions. I have two different workflows against the same list.

The first workflow fires when a new PO is created and saved. Workflow number 1 does the following:

1. Checks the company name that the PO is for.

2. Creates a PO number with a certain prefix before the number depending on the company.

3. Moves to the approval process where it checks a Set Condition against a dollar value.

4. Approved or rejected by your boss. Then moves on to be approved or rejected by Accounting.

This workflow is set to start automatically and start when items are created, as seen below:

172805_pastedImage_0.png

The above scenario works very well and is doing everything correctly.

The second workflow is a copy of the first workflow, but with the steps for the creation of Purchase Order number removed. I want this workflow to run if and or when someone modifies the original purchase order. I have set the workflow settings for the second (or modification workflow) as seen below:

172806_pastedImage_1.png

My problem is, that when testing the creation of a new Purchase Order Requisition the first workflow fired correctly and sent out notifications and created the Purchase Order number. Part way through the first workflow process the second workflow (the modification workflow) started and sent out notifications and running through the workflow process.

Can Nintex have two or more workflows on the same list at the same time?

What is the best way to run the modification workflow so that it will only run if someone modifies the Purchase Order after it has been created?

How or what can I do to get the modification workflow to check what has been edited and depending on the edit made to the purchase order start the approval process again (as an example, if the dollar value of the Purchase Order has increased it needs to go through the approval process again)?

Any assistance is appreciated.

Thank you


4 replies

Badge +4

Hi Sean,

Yes Nintex can definitely do this. Here are a few suggestions:

Option 1) Instead of having two different workflows, have one single workflow that runs on create and modify and build in logic (Conditional Statements, or Switch, or IF) to have it create the PO only if the PO field hasn't been populated. For istance you could do an if statement at the beginning that checks to see if the PO field is empty and if so do your PO creation logic. This will ensure that modifications during the approval workflow don't kick off another instance, but when no approval workflow is running it will kick it off again.

Option 2) Build in logic on your update only workflow so that it checks to see if another instance is already running. This means you need to build in some updates to your created and update workflow that set a field (like a status) to denote that a workflow is in progress, and then update to complete once the workflow ends. This will allow you to then build logic to check to see the status and either begin a new approval process or end the workflow without running.

As far as tracking what field has changed and what it's changed to, that's a bit more complex. You could try using webservices to access version history and do a comparison or you could build some additional fields that store the old value and get updated by workflow once the approval completes.

Hope this helps.

Owen Runnals

Director of Professional Services - General Networks

Badge +6

Sean,

Further to Owen Runnals​ excellent suggestions, you can change the starting of the update workflow to be conditional and base that on some filter that would only be applicable for items where the first workflow has finished or do you envisage that both workflows would ever be running at the same time?

We would have the first workflow set a status field to dictate where it is up to along the way. Only when the status is at an appropriate stage would you allow the update workflow to run. It depends on the logic that you want to follow.

Cheers,

Mark

Badge +11

I'd go with option 1 that Owen recommended. It is easier to maintain and troubleshoot if you only have 1 workflow running.

Badge +7

Sorry for the delay on getting back to everyone regarding my post.

I would like to thank Owen and Colin for the solutions that they provided.

I would like to thank everyone for your input, as it is greatly appreciated.

Sean

Reply