Hi,
I’ve got a very simple workflow, with few Service Tasks, no branches, just one task after the other till the end.
Additionally I implemented a custom IncidentHandler to catch and process any thrown exception.
So I start a process passing an input variable with value “VALUE_1”
String processInstanceId = processEngine.getRuntimeService()
.startProcessInstanceByKey(PROCESS_NAME, Variables.putValue("var_name", "VALUE_1"))
.getProcessInstanceId();
Then in a Service Task I update that variable to VALUE_2:
execution.setVariable("var_name", "VALUE_2");
If an exception is raised from any of the following Service Tasks, the IncidentHandler kicks in and I need to fetch the modified variable, which I do like this:
var my_var = (String) executionEntity.getVariable("var_name");
The point is that if in the IncidentHandler I print out that value I get VALUE_1, so it looks like the update in the Service Task didn’t stick.
What am I doing wrong?
Thanks.