Process variable history

I am searching for a way of finding all the changes for a given process variable for finished processes.
Lately I found this post where something similar is being done, but quite the same. I guess.
With the proposed solution in that post, I could only get the last value of the process variable, which is not really what I need.

For instance, I would like to be able to write in a PDF document how a variable changed along with an approval process.

What I am searching for something like the picture below. This is The variable log offered in the Camunda Cockpit Enterprise version.

It would be great if I could get some hints on how to solve this with the Java ot the REST API.
Thank you!

Hi Wagner Otto Wutzke,
See HistoricDetailQuery example in below link

1 Like

Hi Wagner Otto Wutzke,

In addition to Hassans’s reply, you can also get the historic details using the REST API using the below link


Thanks for the support!

Just for close this matter, this is what I figured out to be working for me:

public List<WorkflowStep> getHistoryForProcess(String processInstanceId) {
	final List<WorkflowStep> workflowSteps = new ArrayList<WorkflowStep>();
	final List<HistoricTaskInstance> instances = historyService.createHistoricTaskInstanceQuery()
	for (HistoricTaskInstance task : instances) {
		List<HistoricDetail> historicDetails = historyService.createHistoricDetailQuery()
		List<HistoricVariableUpdateEventEntity> taskChanges = getRelevantChanges(historicDetails);
	return workflowSteps;

private List<HistoricVariableUpdateEventEntity> getRelevantChanges(List<HistoricDetail> historicDetails) {
	List<HistoricVariableUpdateEventEntity> changes = new ArrayList<HistoricVariableUpdateEventEntity>();
	for (HistoricDetail detail : historicDetails) {
		HistoricVariableUpdateEventEntity variable = (HistoricVariableUpdateEventEntity) detail;
	return changes;


1 Like

Hi again!

Somehow the last completed task is not being listed with the described HistoricTaskInstance query.

The piece of code above is running within a delegate, which is being called by a final ServiceTask at the end of my process. It should generate a pdf document containing the list of executed User Tasks and their assignees, plus which fileds have been changed in each task. It works so far as expected. The only problem is that the last approval User Task in the process (Approve Application NPM or Approve Application NPM Delegated in the picture) is not being listed.

Could it be possible, that the history service needs some time to process changes, before I can query the final changes? Or could this be a bug?

I would appreciate any help very much.

Hi Otto,

If you invoke your code shown above in the same transaction as the user task, it is not able to retrieve the data of the usertask, because the transaction is not yet committed to the database.
You could mark the servicetask using your code as ‘async:before=true’. This would flush the transaction regarding the usertask to the database and you should be able to get the data then.


Awesome! Thanks Christian.
I was searching for the solution and I found this here.
The article says Asynchronous continuations after an activity are useful if you want to make sure that the state changes performed by the activity are saved before the process engine continues process execution.
I tested it and Asynchronous Synchronization solved the problem when I marked both last User Tasks with “Asynchronous After”.
Really great stuff!!!
Thanks a lot!