Set local task variables on create event

Hi, im trying to set local variable on a task with a script, i have configured my user task this way:

However from cockpit i can see that the variable was set with a process scope which is not my desired behavior:

Where have i made a mistake? How can i properly set local variable on my task?

1 Like

@JohnArray local variables can be set to task entity and/or execution entity.

should be like this:

To set local variable to taskEntity:

task.setVariableLocal("variableName", "variableValue");

To set local variable to executionEntity:

execution.setVariableLocal("variableName", "variableValue");
1 Like


Is this the only way of setting a task local variable (i.e. via Task Listener and ‘Script’ listener type)?

  • Can a local variable be set via the ‘Expression’ type?
  • Can the task listener be avoided?

@vadim.prudnikov local variable can be set via ‘Expression’ too.