Modify process variable on historical instances

Hello I have a requirement of reconcile some variable data on historical instances. It seems it cant be done via historyservice.

I am using spring boot integration. Does anybody know how I can get a instance of commandcontext so i can get various entity managers?

Many thanks


It should not be necessary to use entity managers directly. Everything should be possible via the HistoryService and then the HistoricVariableInstanceQuery or one of the other historic queries that are offered.

Best regards,


Hi Tijs, thank you for your prompt reply as always. So after I retrieve the variable, which method should I use to update it?


Ok understand your point now. You would like to update an historic variable.
You could use the ManagementService executeCommand method and create an inner class Command implementation that gives you an instance of the CommandContext. And then you can get the HistoricVariableInstanceEntityManager from the CommandContext.

Best regards,


Works. Thank you very much Tijs!

Can you provide a demo?

managementService.executeCommand(new Command<Void>() {

public Void execute(CommandContext commandContext) {
//How to do ?
return null;

@youlingke I would suggest you to have a look at the variable CommandContextUtil for a way to achieve what you are looking for

thanks for your help

HistoricVariableInstance variables = historyService.createHistoricVariableInstanceQuery().processInstanceId("cb7d7fb7-db56-11e8-bea6-1866da092836").variableName("theme").singleResult();
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables;
historicVariable.setTextValue("hollo word");