AnsweredAssumed Answered

The value of ACT_INST_ID_ is null in table ACT_HI_DETAIL from sub process

Question asked by scryed0204 on Nov 14, 2016
Latest reply on Nov 21, 2016 by motorina0
Dear all:

Sorry about my poor English and I will try my best to describe the problem I encountered.

Now I am using the following code (with SQL )to query the historical variables values in my flow listeners:

1. HistoricActivityInstance previousAct = historyService.createNativeHistoricActivityInstanceQuery().sql("select * from ACT_HI_ACTINST where TASK_ID_ = #{taskId}").parameter("taskId", previousTaskId).singleResult();

*By this code I can get the previous Act Instance

2. HistoricVariableUpdate previousTaskIdVar = (HistoricVariableUpdate) historyService.createNativeHistoricDetailQuery().sql("select * from ACT_HI_DETAIL where ACT_INST_ID_ = #{actInstId} and NAME_ = #{name}").parameter("actInstId", previousAct.getId()).parameter("name", "previousTaskId").singleResult();

*Since the process variable "previousTaskId" will keep being updated during the process move forward, sometimes I need to update the variable's value back to a certain state. By this code, I can update the value of "previousTaskId" to the corresponding value I need with the history record stored in ACT_HI_DETAIL. And what I need here for the query condition is "ACT_INST_ID_ ".

The mechanics was perfect until I added a embedded subprocess in my bpmn.
I realized that the ACT_HI_DETAIL  table won't store the proper ACT_INST_ID_ value if a variable update event was happened in my  embedded subprocess. The ACT_INST_ID_ will be set as NULL in the table column.

Could anyone share some advice? I really need a way to store proper ACT_INST_ID_  value to the ACT_HI_DETAIL table when running my subprocess!
I will be so much appreciated if anyone can help!
Thank you!