cancel
Showing results for 
Search instead for 
Did you mean: 

Values missing in ACT_HI_VARINST table

pan_arker
Champ in-the-making
Champ in-the-making
Hello,

I want to remove all references to overwritten values of variables in my activiti project, but still have access to the values held when the process ended. I was hoping to do this by setting the history level to "activity", as the user guide says "At the end of the process instance, the latest values of the top level process instance variables will be copied to historic variable instances." However, the only values in the ACT_HI_VARINST table are booleans. Please can you explain how I can get the values of the other variables? (they are all strings)

Thanks,

Pan
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
> However, the only values in the ACT_HI_VARINST table are booleans.

That can't be correct. What data are you seeing?

Also, what happens on different levels of history?

pan_arker
Champ in-the-making
Champ in-the-making
The columns BYTEARRAY_ID, DOUBLE, TEXT and TEXT2 are all empty. The column LONG has values (0 for false, 1 for true) if VAR_TYPE is boolean, otherwise it is also empty. TASK_ID is also empty.  All other columns are complete.

This is the case when history level is activity, audit or full. I can't use none as I get an warning "In order to use comments, history should be enabled" (I have made quite a few changes to the Explorer module)

The issue I was trying to address was to remove sensitive information from the database at the end of a process execution. I hoped to do this by setting all the relevent variables to an empty string and having history level set at activity. The old values were still in ACT_HI_DETAIL though.

I have now worked out (with a little help from my friend) how to query the database from a JavaDelegate class and delete the necessary data that way, using the following code.

String processId = execution.getProcessInstanceId();
ManagementService m = execution.getEngineServices().getManagementService();
String tableName = m.getTableName(HistoricDetail.class);
String baseQuerySql = "DELETE FROM " + tableName + " WHERE PROC_INST_ID_=" + processId + " "
                + "AND NAME_ IN('firstName','lastName','address')" + ";";
HistoryService h = execution.getEngineServices().getHistoryService();
h.createNativeHistoricVariableInstanceQuery().sql(baseQuerySql).list();

In order to delete the same data, when it was used in a called subprocess, I got that process's ProcessInstanceId as a variable and used that in a second query.

So as long as the values in ACT_HI_VARINST remain missing, I'm OK! Maybe I should include a query to delete them too, just to be safe.

jbarrez
Star Contributor
Star Contributor
"The old values were still in ACT_HI_DETAIL though."

yes, that is the point of an audit trail.

The approach you describe there works of course. I would add the missing vars too … it doesn't sound right you are not seeing them!