Camunda 7 : Modification inside the multi-instance loop

Hi Team,

Is there any way to update variable on subflow embedded in multi-instance loop?

My requirement is as below- I have modelled multi-instance loop which will execute subflow in parallel for no of itemIds. Now i have interupting conditional boundry event on one of the activity which is there on embedded subflow. Now to trigger that conditional event for one of the instance, i want to update variable associated with that conditional event so that this instance gets completed.

In my case variable will be - “complete” and value - “true”.

Thanks,
Pradip patil

Hi @Pradip_Patil

You need to define a complete variable for each instance of the multi-instance embedded sub-process.
You can achieve this by defining an input parameter complete with an initial value set to false on the embedded sub-process activity and changing the conditional event’s Variables events value from create,update to update only. Doing so will create a complete variable for each instance of the multi-instances created. Once any gets updated to true, the conditional event linked with that specific instance gets triggered.

Got it @hassang . But next question comes as how to identify which instance variable to update and how to update its value?

For updation we can use process instance variable setVariable method. but we will have n number of variable instance as well.
i.e. runtimeService.setVariable(procInstanceId, “complete”, “true”);

In my case I dont want to update all the variable instances and even not in one go.

Hi @Pradip_Patil

The variable should be set at the execution scope rather than at the process instance scope.