User tasks and variables passed in complete method

When one calls “void complete(String taskId, Map<String, Object> variables);” method from TaskService interface, do those variables get applied as global to process instance? Or…?

As context, here’s a diagram of an imaginary process:

User task “Confirm Item Processed Info” is within a subprocess (of a multi-instance subprocess called “Inner Handling”) called Item Inner Handling. I made it more complicated than necessary on purpose in order to test something else. (Of course, the inner handling could have been absent here.)

The “Confirmed” variable used in Confirmed gateway is coming from this user task. Should I pass it in the complete method of user task? Should I rather set it to the parent execution as a local variable?

Can you comment, please?

Cheers!

It is context-based.

The Confirmed variable should be defined within the appropriate scope—either as a local variable tied to the specific instance of the multi-instance sub-process “item handling” or as a local variable within the inner sub-process “item inner handling”. This can be easily managed using the input mechanism.

Yes, the Confirmed variable is intended to be set via the complete method.

1 Like

Thanks much. Am I correct to assume that complete method will set the passed in Confirmed variable value on the first scope it encounters while bubbling up which contains a variable with that name and if none found, it will set it to global process instance scope?

That is correct :ok_hand:

1 Like

@hassang Thanks very much for all your kind and prompt help provided to me over the last 1-2 weeks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.