Vadim Tabakman

In contrast to the Nintex Workflow Request Data action, which only supports getting data from a single user, the Assign a ToDo Task can assign tasks to many users.  Often, you may have a single Assign a ToDo Task action, assigning tasks to several people.  For this example, lets say it's 3 people.  This action will then sit and wait for all 3 users to complete their tasks before the workflow will continue.

But, lets say you have a business requirement where by if one of those users fills in an exorbitant amount for some field of the task and completes the task, you want to catch that as soon as possible and do something about it.  You may not necessarilly want to stop the Assign a ToDo Task, but you may want to notify the manager or IT because the faster something gets done, the better.

Or how about a different scenario.  You assign a ToDo task to 3 users, 1 of which is a Managing Director.  You want to get data from all users, but if the Managing Director chooses to say No to a particular field in the task, then you need to notify the other users.

In both scenarios, the Assign a ToDo Task will wait and you won't be able to do anything until every task is completed.

Solution

We need a solution whereby we can figure out how many tasks we need to look at.  We can type this in at design time, but it would be more robust if we could figure it out at runtime.

1. Problem one : find out how many tasks we have

The default tasks list for Nintex Workflow is called Workflow Tasks.  All tasks will be created in this list.  To narrow down the search, we can search for all tasks created by the current workflow instance.  We do this by querying the Workflow Tasks and compare the Workflow Instance ID of the task to the Workflow Instance of the running workflow.

Query All Tasks Configuration

This will narrow it down a little, but we need more.

A workflow can have multiple task related actions.  How do we narrow it down?

One way would be to give the Tasks a unique name.  But that can get messy.  Instead, just before the Assign a ToDo Task action, we add a Calculate a Date action.  We configure this to store the current date and time in a Date/Time variable.  Now in our query, we can search of all tasks that have the current Workflow Instance ID and also those whose Created field is greater than or equal to our stored DateTime.  This will find all tasks created by this workflows after a specific date and time.

Current Date Time

NOTE: I can think of one scenario where this may not work.  If you have Task related action in parallel branches, the Query List action will find all the tasks and not ones specific to a task action.  But how often does this happen?

Now that we can query for all the tasks, the results can be stored into a Collection variable and we can get the count using a Collection Operation action.

Query For All Tasks

2. Problem two : loop through all the tasks until all are completed

For this post, we'll simply build logic that will loop until all the tasks are completed.  If you want more, list retrieving the data from the tasks and doing something with it, you can simply add to this logic of the workflow that is downloadable at the bottom of this post.

Since we know how many tasks we have, we now have to keep a running tally of processed users and we continue looping until we have processed every task.

We use a Loop action configured to compare the total number of user tasks to the running tally.  Since I work in an environment which has Safe Looping disable (I don't recommend this), I have added a Pause at the bottom of the loop.  This will pause for 1-5 minutes and will prevent Loop going crazy constantly querying the Workflow Tasks list.

Loop

Two things are important in the loop.

a. The Query List action now queries for tasks for this workflow instance, that were created after our stored data and also where the Status = Completed.  This means we only received completed tasks and minimizes our processing.

Query Completed Tasks

b. It checks again if we have processed all the users. If we haven't, only then does it do the pause.  Otherwise, since we've processed all the users tasks, the loop can exit out and the workflow can continue.

Check Number of Processed Users

Conclusion

You may find that the Content Type the Assign a ToDo Task action is using doesn't exist in your environment.  You can just create a dummy one for this test and use that.

Hopefully this post will show you that you can do things with the Assign a ToDo Task actions "tasks", even though the action itself will sit and wait until the task is complete. 

If you wanted to manipulate the tasks, you could look at using the Update Item action and set the Status to "Completed" and I like to set the % Complete to 100 also.

Downloads

Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Wednesday, April 3, 2013 4:27:46 AM
ParshuramChenna

re: Nintex Workflow - ToDo Task Parallel Processing

hi;

 

I have a requirement for a Loan processsing where a loan offer is made to a customer and the workflow is awaiting for the response from the customer; the response could be

 

1. Customer Accepts the Bank Loan Offer and the user fills up the offer accepted date

2. Customer declines the Bank Loan Offer and the user fills up the offer decline date

3. the Bank Loan Offer gets expired. the expiry date is set to Loan Offer Date + 6 months.

We would like to update the SQL Table for setting the status of the Loan as 'Customer Declined' + Declined Date and then terminate the workflow

We would also like to update the SQL Table for setting the status of the Loan as 'Offer Expired' and then terminate the workflow

else record the actual Customer Acceptance and update the SQL Table for setting the status as 'Offer Accepted' + Date of Acceptance and continue performing other actions normally.

 

How can we design this scenarios using Nintex.

 

Thanks

Parshuram

Wednesday, April 3, 2013 1:26:15 PM

re: Nintex Workflow - ToDo Task Parallel Processing

Definitely look into scheduling workflows.  I think that would help you here Parshuram.

You can either create the schedules via a web service call to /_vti_bin/NintexWorkflow/Workflow.asmx

Or you can start a workflow on a schedule using the Start Workflow action.

Sunday, June 30, 2013 11:51:26 PM
Rick

re: Nintex Workflow - ToDo Task Parallel Processing

Thanks Vadim - this helped me big time :) I assume there is no way apart from this to get the TaskID from the task until it's been actioned?

Monday, July 1, 2013 9:24:44 AM
unknown

re: Nintex Workflow - ToDo Task Parallel Processing

Hi rick, I'm glad this helped. I don't know of another way. The only thing I can think of is that you have a workflow run on the task and then send a message back to the original workflow. I think I'll try this out using the Store Data action. Cheers, Vadim
Thursday, December 5, 2013 8:34:16 AM
Christian

re: Nintex Workflow - ToDo Task Parallel Processing

Hi Vadim, 

The dates comparison does not work for me. When I run the list query without any filter, it is working properly. But when I run the query with a filter with dates comparison (comparing "created" with any other date) no results are returned. I have tested with several date formats.

Would you have any clue?

Thanks in advance,

Christian.

Thursday, December 5, 2013 8:35:58 AM

re: Nintex Workflow - ToDo Task Parallel Processing

Hi Christian,

what kind of comparison are you doing?  I can see how it may not work if you do an "equals" comparison as one field may have a time and another might not.

Does it work if you're doing a less than or greater than comparison?

cheers,

Vadim

Sunday, June 15, 2014 8:38:33 AM
ngufighter
Gravatar

re: Nintex Workflow - ToDo Task Parallel Processing

hi,

Wheather can Nintex WorkFlow countersign many  departments  at the same time and countersign department can also perform concurrent processing.If Nintex WorkFlow can do this and can you provide some solutions,thank you very much!

Sunday, June 15, 2014 9:26:21 AM

re: Nintex Workflow - ToDo Task Parallel Processing

Hi ngufighter,

Can you please explain what you mean by countersign?

If you're talking about approvals, you can use a Flexi Task action to assign tasks to multiple people at the same time.

Cheers,

Vadim

Tuesday, May 12, 2015 12:45:16 AM
Happy
Gravatar

re: Nintex Workflow - ToDo Task Parallel Processing

I have a requirement to send email alert on every 2nd monday of the month. Is there any way to create a workflow without using excute SQL action.

Tuesday, May 12, 2015 8:46:56 AM

re: Nintex Workflow - ToDo Task Parallel Processing

Hi Happy,

not that I'm aware of. I don't know of any other way at the moment of figuring out the 2nd Monday of the month.

cheers,

Vadim

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register

Statistics

  • Entries (279)
  • Comments (1769)

Categories