Start the subprocess parallel with values from paraent workflow

Hi all,

I have one scenario, one service task returns the list of values as response from connectors , based on these values , we need to start the same subprocess paralally by passing each value from list,which given by parent service task.

E.g: result list =[“PI”,“DV”,“SI”,“PA”] service task response vales from parent workflow, Based on these values we need to start the same subprocess paralally by passing each value.so finally we need to have 4 subprocess.

i.e 1st for PI,
2nd for DV
3rd for SI
4th for PA , Here same sub process with paralally start .

Kindly provide any sample workflow for this.

Thanks
Vemula

@vemulabujji From your parent process, collect the results as list as you mentioned result list =[“PI”,“DV”,“SI”,“PA”] . After the service task create a multi-instance call activity to start the subprocesses in parallel as per the below model.

lets say your result list variable is subProcessList=[“PI”,“DV”,“SI”,“PA”] and assign a element variable as subProcesskey to loop through the list elements and it will be assigned to the calledElement attribute of call activity. (refer the diagram)

Thanks Arivind,

We need to execute the further task in the parent workflow based on only complete all these subprocess. So what is the completion condition for these subproces workflows?

Thanks
Vemula

@vemulabujji it depends on how are you modelling your parent process. The example is just having service task and call activity. When all the subprocess completes or completion condition evaluated to true, then parent process also will end.

Hi Aravind,

How do we ensure all the sub process completed?
Please find the attached sample workflow.Kindly let me know the sample completion condition ?

sample.bpmn (5.9 KB)

Thanks
Vemula

Completion condition is optional, it means if completion condition is not given, then all the multi instances are expected to complete in-order to execute the next activity in the process, so still that execution token will waits in the multi-instance activity until all the instances completes.

When the completion condition satisfies, and if few multi instances are still active, then those instances are deleted and the process continues to execute further activities in the process.

for more details refer the docs for completion condition in multi instance activity.

Hints:

  • nrOfInstances : the total number of instances
  • nrOfActiveInstances : the number of currently active, i.e., not yet finished, instances. For a sequential multi-instance, this will always be 1
  • nrOfCompletedInstances : the number of already completed instances
  • loopCounter : indicates the index in the for each loop of that particular instance
<userTask id="miTasks" name="My Task" camunda:assignee="${assignee}">
  <multiInstanceLoopCharacteristics isSequential="false"
     camunda:collection="assigneeList" camunda:elementVariable="assignee" >
    <completionCondition>${nrOfCompletedInstances/nrOfInstances >= 0.6 }</completionCondition>
  </multiInstanceLoopCharacteristics>
</userTask>
1 Like