cancel
Showing results for 
Search instead for 
Did you mean: 

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

scryed0204
Champ in-the-making
Champ in-the-making
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!
1 ACCEPTED ANSWER

motorina0
Confirmed Champ
Confirmed Champ
Hi,

    Your problem seems to be the same as this one:  https://activiti.atlassian.net/browse/ACT-4144

    You must have/create an user to see the details, but in short:
<code>
If I store variables with:
     processEngine.getTaskService().setVariable(taskId, "var_1", "this is a save var");
With activiti 5.19.0.2. In the database. ACT_HI_DETAIL table: the "ACT_INST_ID_" field is null.
With activiti 5.16.4 the field has the correct value (the ID of the activity).
</code>

    The bug is fixed in this pull request: https://github.com/Activiti/Activiti/pull/1068
    But not yet merged into master.

Vlad,

View answer in original post

2 REPLIES 2

motorina0
Confirmed Champ
Confirmed Champ
Hi,

    Your problem seems to be the same as this one:  https://activiti.atlassian.net/browse/ACT-4144

    You must have/create an user to see the details, but in short:
<code>
If I store variables with:
     processEngine.getTaskService().setVariable(taskId, "var_1", "this is a save var");
With activiti 5.19.0.2. In the database. ACT_HI_DETAIL table: the "ACT_INST_ID_" field is null.
With activiti 5.16.4 the field has the correct value (the ID of the activity).
</code>

    The bug is fixed in this pull request: https://github.com/Activiti/Activiti/pull/1068
    But not yet merged into master.

Vlad,

motorina0
Confirmed Champ
Confirmed Champ
PR merged into master and into activiti6 branch.
Please make a new build and re-check if the bug reproduces.