Pass variables from SubProcess to a task


I have a sub process wich has 3 end event.
I set the same variable on this end events like the above

then on the execute method, I tried to get the value

    String status = (String) execution.getVariableLocal("leaveStatus");

But this doesn’t work. I got null as a value

Any ideas?



maybe you can try this

String status  = (String) execution.getVariable("leaveStatus");


I tried it. It returns nul pointer exception


You set variable in a sub-process scope so this variable is not visible outside sub-process. Consider using signals in order to determine which exit condition you reach within your sub-process. Here is a simple example of mentioned approach SignalTest.bpmn (10.8 KB)