Setting execution-local variable from user task from within multiinstance execution

Hi there,

How can I set an execution local variable on completion of a user task belonging to that particular execution if execution corresponds to one instance of multi-instance embedded subprocess? Is it possible?

Thank you.

Hi @Cristian

Using input mapping on the multi-instance embedded sub-process, you can define local variables for each instance.

Input and output variable mappings can be defined at the multi-instance activity; they are applied on each instance on activating and on completing.

Thank you, @hassang.
Let me explain again, I wasn’t clear enough. I have a multi-instance embedded subprocess made of one user task and one service task. I produce in the user task a value that will be used in service task coming right after. I know that TaskService has an overloaded completeTask method with a second param of type Map which may be used to set process instance variables into the execution. I could use that, considering each of the parallel instances will overwrite previously set value into execution and the use it in service task because they will be part of same DB transaction. But I wonder if there is a way to set that value produced by user task as an execution local variable and then retrieve the local variable from service task via execution reference. The method TaskService.setVariableLocal seems to set it to the user task local scope, not to the associated execution’s local variable store. Is my last statement correct?