cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a variable set in the DelegateExecution

mark1970
Champ in-the-making
Champ in-the-making
Hi all,
I'm just beginning learning Activiti and I'd need a bit of help with Execution variables.
I'm setting some variables in a serviceTask

public void execute(DelegateExecution arg0) throws Exception {
                           . . . .
           arg0.setVariable("user", rs.getString(1));
}

however I'd need to read this variable from an EJB, so I tried:

ExecutionQuery execution = runtimeService.createExecutionQuery().processInstanceId(procId);
List <Execution> list = execution.list();

However the single Execution instances do not contain any getVariable method.
What's the correct way to retrieve the variable value ?
Thanks
Mark
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
You should use the runtimeService for this and fetch the variables for the execution you want:


runtimeService.getVariables(execution.getId());
runtimeService.getVariable(execution.getId()"varName")

mark1970
Champ in-the-making
Champ in-the-making
thanks a lot!
Mark