logo

Assigning tasks to multiple users via sub processes

This example shows how to assign similar tasks to multiple users simultaneously in the business process.

You can assign tasks to multiple users at the same time, using an external subprocess with the Multiple execution marker. However, the subprocess context won’t be transmitted to the parent process.

This can be done as follows: 

  1. Add all users who must be assigned the same task to the context variable of the Block type in the task (the block must have a property of the User type).
  2. Next to the task activity, place a script activity with a context variable, which stores the number of items in the block.
context.Number= context.Blok.Count;
  1. Add another script activity:
context.Number = context.Number-1;
context.Addressee= (User)context.Blok.ToArray()[(int)context.Number].of users;

Context variables of the process:
‘Block’ - a block which stores the task executors;

‘Addressee’ - the output variable of the User type;

‘Number’ - a variable of the Integer type.

      4. Then place the external sub-process activity, enable the Multiple execution marker, specify the input variable ‘Addressee’ in the settings. In the parent process, use a dynamic swimlane (a task executor is selected from the list). Select the ‘Addressee’ variable to determine the task executor. The external sub-process must include a swimlane with the input variable of the User type. 

      5. Determine the condition for the block checking. To do this, add a XOR gateway to check the variable ´Number´: if it´s not 0, then proceed to the second script, where the next item is selected. If it´s 0, then the process ends.