AnsweredAssumed Answered

Cannot get process execution variables in latest state

Question asked by dmitry.serdiuk on May 20, 2011
Latest reply on May 16, 2013 by rahult
Hello.

I'm trying to write an integration test for my Activiti process, which contains a lot of Script tasks. I basically need a way to retrieve process execution variables. First I've tried placing a dummy Java Receive task at the process' end and then retrieve the variables using
runtimeService.getVariables(processInstance.getId());
, but only got the variables in their initial state (e.g. I've passed an empty array in the process and filled it inside my Script tasks, but get an empty array again as a result from calling getVariables(instanceId)).

After that I've set ProcessEngineConfiguration property 'history' to 'full' and tried querying for variableUpdates
historyService.createHistoricDetailQuery().variableUpdates().processInstanceId(processInstance.getId()).orderByTime().desc().list();
which, in turn, returned me variables as they were passed in the process.

Why does it happen and how can I check that process execution variables?

P. S. I'm testing with JUnit and Spring.

Thanks.

Outcomes