Parallel Flexi Tasks and Wait for all replies

Blog Post created by jackgelo Champion on Jul 12, 2017


one of my customer needed to send out several tasks in parallel but they have one issue: they don't know at design time how many tasks have to be created (it depends on a user field in a list) and they need to store all the outcome of the tasks..


Unfortunately for Flexi Tasks there is no behaviour like "wait all replies" so I've started building a possible workaround:


What i need is my main list workflow and a site workflow, here's my recipe (inside the text, all the variables are written in italics in order to distinguish them from normal text).

For list workflow:


Variables for List WF (I've used Users instead of referencing a user field, but it doesn't change anything in the logic), Missing Answers has a default value of Yes.


The workflow:

First, I need to split with semicolon my user field with a Regular Expression and store it in the collection variable, after that, inside a For Each I've called a webservice in /_vti_bin/nintexworkflow/workflow.asmx to start a Site Workflow (the one we're going to build later) passing some parameters like current user inside the for each, the index and Workflow Instance ID (it's available under common reference).

When executed, the workflow will then start the auxiliary site workflow for the number of user in my Users variable/field, but how to wait until all the sub-workflows are completed and how to get their outcomes?


After the For Each I've added a loop with exit condition based on Missing Answers variable, at the beginning of each Loop that variable is set back to False, Outcomes variable is blanked and then I have again a For Each based on my previous Collection, also this action as Stop processing based on Missing Answers.

Inside this For each, I have a Retrieve data action that checks for current workflow the item OutcomeIndex (where Index is my variable) and store the result in SingleOutcome. If SingleOutcome is not empty, I add it to the general Outcomes variable otherwise I set the MissingAnswers to true (so the ForEach will ends).

Outside the For Each (but still inside the loop) I've a Run if that checks again if Missing Answers is true and in case it pause the workflow for a proper amount of time (how frequently you want to check the answers?). At the end I log my Outcomes to show all of them.

For site workflow:


 The three variables that needs to be shown on start form are the parameters you have to pass when starting the workflow with the web service in the list workflow.


The workflow:

This workflow is very simple, it has just an Assign Flexi Task assigned to Assignee variable and outcome is saved in Outcome.

After the task I have a Store Data Action that store in a workflow with instance InstanceId, in an item named OutcomeIndex (here again, the name should be the same used in the Retrieve Data action in the list workflow) and the value is obviously Outcome.


That's all, it may be a little bit overwhelming but it works and it's extensible if you need more information about the task (you can simply store additional items with the same logic and then you can retrieve them in the main workflow)