Set Variable to Multi Instance Execution

Hi,

I have a process with a multi instance sub process.
In sub process I complete a task via rest call.

When completing the task I want to set a variable sent by client to the parent scope of the task means one execution of the multi instance sub process.

How can I achieve this? Do I have to use a execution listener on task or is it possible to do it via rest call?

If my description is not clear I could add a process

Best regards,

Markus

Hi Markus,

You can’t define the scope of the variable in the REST call. As workarounds, you could work with execution or task listeners as you say. As an alternative, you can initialize the variable in the correct scope before the task is completed (given you know the name beforehand). Then, the default variable propagation behavior will set the variable in the right scope.

Cheers,
Thorben

1 Like

Hi @thorben

Do I understand you right?

I will do the following steps:

  1. I initialize the variable (myVar) in the multi instance scope with an empty value
  2. I complete one task of the multi instance scope and send variable (myVar) in the complete POST of the task
  3. The variable (myVar) will be mapped to the multi instance scope and not to the global scope?

Just for my clarification

Best regards,

Markus

1 Like

Yes, if by “multi instance scope” you mean the sub process that is marked multi-instance.

Thank you very much I will try this approach.

best regards,

Markus

Works fine for me.

Thank you @thorben