AnsweredAssumed Answered

Persisting modified variables in scriptTask

Question asked by thomasl on Sep 5, 2013
Latest reply on Sep 13, 2013 by trademak
Hello,

I start a process with an output variable which is a basic HashMap. In a javascript scriptTask, I insert some values into this map as follows:


output.put("result", "success");

If I read the process variables inside an ExecutionListener at the end of the process, the result value is as expected :


public void notify(DelegateExecution execution) throws Exception {
   String result = ((Map) execution.getVariable("output")).get("result"); // success

However, the modified variable is not persisted in the DB, a HistoricVariableInstance query returns the variable state at the beginning of the process. To have the variable persisted, I have to force it manually:


output.put("result", "success");
execution.setVariable("output", output);

Is it the intended behavior ? Do I have to manually persist all variables modifications ?

Regards,

Tom

Outcomes