cancel
Showing results for 
Search instead for 
Did you mean: 

How to recover variables after the execution of the process?

rodolfobarbeiro
Champ in-the-making
Champ in-the-making
Hi!

I'm trying to retrieve the variables of a process that has no "waitState" task. But an error occurs because the process instance is already closed.


ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processName, parameters);
         
Map<String, Object> variables =  runtimeService.getVariables(processInstance.getId());


Is there any other way to recover the process variables?

Thanks!
9 REPLIES 9

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
from the history

rodolfobarbeiro
Champ in-the-making
Champ in-the-making
How?

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
By reading the docs… e.g. chapter 10

rodolfobarbeiro
Champ in-the-making
Champ in-the-making
I've seen the chapter 10, but could not use the example described.

My code:


ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processName, parameters);
  
List<HistoricDetail> historicList = historyService.createHistoricDetailQuery()
                                            .variableUpdates().processInstanceId(processInstance.getId())
                                            .orderByVariableName().asc().list();

But the list "historicList" is always empty.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
See here

rodolfobarbeiro
Champ in-the-making
Champ in-the-making
I set the "History configuration" as audit, but the historic details are not stored in the database.

rodolfobarbeiro
Champ in-the-making
Champ in-the-making
ronald.van.kuijk

Thanks for your help! I solved the problem!

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
No, I solved the problem 😉 … hope you got my 'hints'

rodolfobarbeiro
Champ in-the-making
Champ in-the-making
Ronald!

Right! You guided me so that I could solve the problem.

Thank you!