AnsweredAssumed Answered

Issue when trying to get process Variable

Question asked by frank41 on Nov 15, 2013
Latest reply on Nov 15, 2013 by frank41
Hi all Activiti users,
I've some troubles when recovering one process variable set within a Service task.
As I understand from the API, I need the executionId in order to get a variable:

runtimeService.getVariable(execId,"myvar");

However the following code give me a NPE:

ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process1",params);

Execution exec1 = runtimeService
              .createExecutionQuery()         
              .processInstanceId(processInstance.getId())
              .singleResult();

System.out.println(exec1); // Null!

Do you have any hint to solve this issue ???
Thanks
Frank

Outcomes