AnsweredAssumed Answered

how to update a process variable?

Question asked by wenweikun@gmail.com on Jul 3, 2013
Latest reply on Jul 3, 2013 by wenweikun@gmail.com
Maybe this question sounds very silly, but I can not find a solution and answer about it.

I user a process variable through the whole process instance.
So my question is can I change the process variable without compete a task?

Below is my sample code:

P1: I user this to get and view my process variable:

ProcessVariable p = (ProcessVariable) runtimeService.getVariable(
               processInstance.getId(), "processVariable");


P2: then I want to update the process variable:
ProcessVariable  is businessprocess Scope, and injected to my class.

processVariable.setStatus("Readed");


after that, I use P1 again to view the process variable
but nothing change to the process variable.

the debug result is, after P2, the injected process variable value have change, but the getVariable result of P1 remain the same..

Outcomes