Create process variable on historical instances

I want to be able to create a new variable on a historic process.
I saw this post which describes how to modify an existing variable to a historic process instance:

I didn’t see how to create a new variable since I need access to an instance of VariableInstanceEntity
for this call -
CommandContextUtil.getVariableServiceConfiguration(CommandContextUtil.getCommandContext()).getHistoricVariableInstanceEntityManager().createAndInsert(newVariable);

Hi,

Historic tables store information about runtime entities which are deleted when e.g. process instance ends.
That’s why you need a runtime variable instance to create some historic var instance.

Regards
Martin

the funtion “getHistoricVariableInstanceEntityManager” in CommandContextUtil is deleted in flowable 6.6.0 ,what can i do ?

You’d need #getVariableServiceConfiguration().getHistoricVariableInstanceEntityManager()