Service Task Result Variable inside multi instance parallel process

I have a multi instance parallel subprocess.

Inside this there’s a ServiceTask with ‘resVar’ defined in Result variable field. The resVar contains a random number in string format.

I noticed that the following scripts in the subprocess are reading a wrong resVar, not the value created in their own instances.

Example of a sequence of events:
time 1. parallel execution1 : serviceTask : resVar = 123456
time 2. parallel execution2 : resVar = 987654
time 3. parallel execution1: service printing resVar —> the output is 987654 (wrong)

So the ‘ResultVariable’ in the serviceTask seems to be global in the entire process, and this should force me to rewrite all subprocess and service calls to avoid using this field and use setLocalVariable. This is mostly inconvenient and frankly non intuitive. Other idea could be to set all those variables as local at the beginning of the multi instance process?

Any clue? I’m using camunda 7.8.

1 Like

Yes, that would be the way to go. Think of it like declaring a variable at the beginning of a scope in a programming lanugage.