Getting historical form data for a process instance
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-10-2012 01:37 AM
Hi all
I have a process which contains the user tasks, am able to successfully submit the user form using activiti api's and the variable data is stored in act_hi_details table successfully.
am not able to retrieve the history data from the act_hi_details table.
As per user guide the query is
"historyService.createHistoricDetailQuery()
.variableUpdates()
.processInstanceId("123")
.orderByVariableName().asc()
.list()" which returns List<HistoricDetail>, but am not able to extract form data i.e, variable name and value from the historyDetails object.
thanks,
kleyo
I have a process which contains the user tasks, am able to successfully submit the user form using activiti api's and the variable data is stored in act_hi_details table successfully.
am not able to retrieve the history data from the act_hi_details table.
As per user guide the query is
"historyService.createHistoricDetailQuery()
.variableUpdates()
.processInstanceId("123")
.orderByVariableName().asc()
.list()" which returns List<HistoricDetail>, but am not able to extract form data i.e, variable name and value from the historyDetails object.
thanks,
kleyo
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2012 06:44 AM
Hello there,
I am struck too…
Need History Form Details…
I am struck too…
Need History Form Details…
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2012 07:05 AM
Hi all
I have a process which contains the user tasks, am able to successfully submit the user form using activiti api's and the variable data is stored in act_hi_details table successfully.
am not able to retrieve the history data from the act_hi_details table.
As per user guide the query is
"historyService.createHistoricDetailQuery()
.variableUpdates()
.processInstanceId("123")
.orderByVariableName().asc()
.list()" which returns List<HistoricDetail>, but am not able to extract form data i.e, variable name and value from the historyDetails object.
thanks,
kleyo
List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
for (HistoricDetail historicDetail : list) {
HistoricVariableUpdateEntity variable = (HistoricVariableUpdateEntity) historicDetail;
System.out.println(variable.getName() + " = " + variable.getValue());
}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2012 07:19 AM
Hi kafeitu,
Thank u for yr immediate reply… I get the following Exception when i try to do that:
I m using activiti-5.10
Thank u for yr immediate reply… I get the following Exception when i try to do that:
Exception in thread "main" java.lang.ClassCastException: org.activiti.engine.impl.persistence.entity.HistoricFormPropertyEntity cannot be cast to org.activiti.engine.impl.persistence.entity.HistoricVariableUpdateEntity
I m using activiti-5.10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2012 08:09 AM
Hi kafeitu,
Thank u for yr immediate reply… I get the following Exception when i try to do that:Exception in thread "main" java.lang.ClassCastException: org.activiti.engine.impl.persistence.entity.HistoricFormPropertyEntity cannot be cast to org.activiti.engine.impl.persistence.entity.HistoricVariableUpdateEntity
I m using activiti-5.10
oh, sorry…
The result contains form datas, you should check type of Detail.
List<HistoricDetail> details = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
for (HistoricDetail historicDetail : details) {
if (historicDetail instanceof HistoricFormPropertyEntity) {
HistoricFormPropertyEntity formEntity = (HistoricFormPropertyEntity) historicDetail;
System.out.println(String.format("form->, key: %s, value: %s", formEntity.getPropertyId(), formEntity.getPropertyValue()));
} else if (historicDetail instanceof HistoricVariableUpdateEntity) {
HistoricVariableUpdateEntity varEntity = (HistoricVariableUpdateEntity) historicDetail;
System.out.println(String.format("variable->, key: %s, value: %s", varEntity.getName(), varEntity.getValue()));
}
}
If you want to query all form datas, you should add a filter only for form properties.
List<HistoricDetail> formDetails = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).formProperties().list();

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2012 09:57 AM
It works… Thank u…

