My BPMN structure has 2 pieces divided by a user-task. As the user-task activity is triggered (wait-state), I want to access the HistoryService and get all the variables and log in my use-case database.
I’m doing this in the last ServiceTask (before the user-task activity),
public void execute(DelegateExecution execution) {
Map<String, Object> outputs = new HashMap<>();
//logic to generate outputs
execution.setVariables(outputs);
}
However, once the above ServiceTask is completed, and My UserTask activity get’s triggered (moves to wait state) and during this flow, I’m trying to get the variables from the HistoryService and the outputs set above is not present in the HistoryService list.
My HistoryService access looks like,
List<HistoricVariableInstance> flowableVariables = getProcessEngine().getHistoryService()
.createHistoricVariableInstanceQuery().processInstanceId(procInstanceId).list();
Also in the flowable xml,
The service task has async = true and triggerable = false
Please help here.