cancel
Showing results for 
Search instead for 
Did you mean: 

Historic Process Variables

dmifs
Champ in-the-making
Champ in-the-making
Hi

I am quite a beginner with Activiti. I am running a simple process which just contains a java task. I am setting some variables and when the process finishes I can see them in the database table ACT_HI_VARINST  as can be seen below

"82707";"82704";"82704";"";"user";"serializable";0;"82708";;;"";""
"82710";"82704";"82704";"";"validationPassed";"boolean";0;"";;1;"";""

Now I would like to retrieve them and I am using the code below

   HistoricProcessInstance history = processEngine.getHistoryService()
               .createHistoricProcessInstanceQuery()
               .processInstanceId(processId).singleResult();
         
   Map<String, Object> processVars = history.getProcessVariables();


however the map is empty and doesn't contain any entries. I am just interested in the final state of the variables and do not need the intermediary state for now. Can you please help?
thanks
2 REPLIES 2

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

try to add following method to your query construction

 
  /**
   * Include process variables in the process query result
   */
  HistoricProcessInstanceQuery includeProcessVariables();

dmifs
Champ in-the-making
Champ in-the-making
that solved the problem!

thanks a lot