We have a case where both process Instances and task instances include a local variable called “state” and based on that history is being recorded. We are trying to search historic process instances based on variable “state” using:
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
query.variableValueEquals(BaseWorkflowNode.PROP_STATE, state)
List<HistoricProcessInstance> historicProcessInstances = query.list();
But we realize that query retrieving historic process instances including for filtering both historic process state variable and historic task state variable which it is not desired. I guess this is due to query api is searching on act_hi_varinst without distinguishing historic process variables (task_id_ = =null) from historic task variables .
I wonder how could I get historic process instances based on just process instance variables without including historic task instance variables?