Nintex Workflow

Nintex Workflow – Wait for Item Change

This interesting question came up on the Nintex Community – Making the workflow wait for one of 4 fields to change.

Since the Wait for Item Update action in Nintex Workflow only supports one condition, how do build logic into our workflow that can check multiple conditions?

To get around the limitation of the Wait for Item Update action (single condition), we have to do some Workflow magic :).  Firstly, since there is the single condition limitation, and in this scenario, we have 4 fields that we want to potential wait for.  More precisely, we want our workflow to wait until any one of those four fields is changed.

In the above screenshot, we have a Title field (we are less interested in that changing) and then we have four fields, that we are interested in.

So what kind of Workflow magic are we doing?  Well, we focus on the Modified field.  This field changes automatically, every time an item changes.  Now, we can use the Modified field in the Wait for Item Update action.  But before we do that, we need to store some current field values into variables.  eg.  store the current Modified value into a DateTime variable, so that we can use that in the condition.

These are the variables in this workflow:

The Workflow Design looks like this :

From the above screenshot, the workflow isn’t complex at all.  Firstly, we initialize our variable (text variables).  Then we jump into a Loop.  The reason we have a Loop, is because inside that loop, we have your Wait for Item Update action that will wait until the Modified field is changed.  This could happen for another field, other than the four we are interested in, like the Title field.  In this case, we want to loop around and go back to Waiting…

Here is what happens as the workflow starts :

Now if we change the Title field, this is what the workflow status looks like:

Notice how the Wait for Item Update action completed and then it went to the Run If.  The Run If ran, but the condition wasn’t met, so the inside action (Set Variable) didn’t run and therefore the workflow went back around the loop, and is now back at the Wait For Item Update action.

If we then modify the item in such a way, that one of the fields is modified that we care about, the workflow status will look like this:

Notice that everything is green, because we found a field that we are interested in has changed, we exited out of the loop and the rest of our workflow can continue.

So what does the Run If look like?

Since we have 4 fields we are interested in, the Run If is configured with 4 condition, all set with an “Or” operator.

The final thing to look at, is the Wait for Item Update action :

Notice that it’s a single Wait for condition, and we are comparing the current Modified field to the DateTime variable we have.  The one main thing to remember here, is that the first action, just before the Wait for Item Update, should be a Set Variable action to get the latest Modified value and store it in the dtLatestModified variable.  That way, each time through the loop, we are using the latest value.

Below is the Workflow and the List Template from this post.  I hope this helps someone.  Feel free to add comments below.

Downloads

Nintex Workflow

Download the Workflow – Download and import into the New Workflow page

Download the List Template – Download, unzip an import it into the SharePoint List Templates

Leave a Reply