Hei guys, how can I get all the transitions before the current step?
Check the History
Accessible via REST
Has previous steps
Yeah, I forgot sorry, i need to do it through Java Api. Is there any way?
As long as you have access to the process engine you can query
execution.getProcessEngineServices().getHistoryService()
.createHistoricActivityInstanceQuery()
.processInstanceId("someProcess")
.list();
Thank you so much kind sir.
Sorry for double posting, your solution works fine, but it doesn’t include the sequence flows, is there any way i can retrieve those too?
Sequence flows are not stored in history - is there a specific reason why you need the sequence flows?
Details, we have a table with all the processes ongoing and when you click on one of them you get all the info about it.
Hello Niall,
I’m trying to get history with this method but getting empty list.
Configurations,
- camunda.bpm.history-level=full //(application.properties) //in act_ge_property history level 3
- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter:3.3.1 //(build.gradle)
- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-webapp:3.3.1 //(build.gradle)
- org.camunda.bpm.springboot:camunda-bpm-spring-boot-starter-rest:3.3.1 //(build.gradle)
I can see details and records in act_hi_detail for my processInstanceId but I can not get them with this method.
What should I do for get my my process details in act_hi_detail at my java project?
Note:(I am not using rest services, using only implementation methods)
Thank you…
Can you post exactly how you’re querying as well as the result and what you’re seeing in the DB?
This one is my Postgre db result;
select * from public.act_hi_detail
where proc_inst_id_ = '41cb914f-8ce5-11e9-8f69-8c16458a51a0’
id_ | type_ | proc_def_key_ | proc_def_id_ | root_proc_inst_id_ | proc_inst_id_ | execution_id_ | case_def_key_ | case_def_id_ | case_inst_id_ | case_execution_id_ | task_id_ | act_inst_id_ | var_inst_id_ | name_ | var_type_ | rev_ | time_ | bytearray_id_ | double_ | long_ | text_ | text2_ | sequence_counter_ | tenant_id_ | operation_id_ | removal_time_ |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
41cd8c2c-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc0581-8ce5-11e9-8f69-8c16458a51a0 | xmlByteArray | null | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cd8c2b-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc0580-8ce5-11e9-8f69-8c16458a51a0 | approved | null | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cd8c2d-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c92-8ce5-11e9-8f69-8c16458a51a0 | xml | string | 0 | 2019-06-12 10:39:49 | <?xml version="1.0" encoding="UTF-8"?>¶<bpmn:definitions xmlns:bpmn=“http://www.omg.org/spec/BPMN/20100524/MODEL” xmlns:bpmndi=“http://www.omg.org/spec/BPMN/20100524/DI” xmlns:dc=“http://www.omg.org/spec/DD/20100524/DC” xmlns:di="http://www.omg.org/spec/ | 1 | ||||||||||||
41cd8c2e-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c93-8ce5-11e9-8f69-8c16458a51a0 | deploymentId | string | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cd8c2f-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c94-8ce5-11e9-8f69-8c16458a51a0 | name | string | 0 | 2019-06-12 10:39:49 | HistoryExample | 1 | ||||||||||||
41cdb340-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c95-8ce5-11e9-8f69-8c16458a51a0 | description | null | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cdb341-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c96-8ce5-11e9-8f69-8c16458a51a0 | versionTag | null | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cdb342-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c97-8ce5-11e9-8f69-8c16458a51a0 | id | string | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cdb343-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc53a8-8ce5-11e9-8f69-8c16458a51a0 | version | null | 0 | 2019-06-12 10:39:49 | 1 | |||||||||||||
41cdb344-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | startEvent:41cd651a-8ce5-11e9-8f69-8c16458a51a0 | 41cc53a9-8ce5-11e9-8f69-8c16458a51a0 | key | string | 0 | 2019-06-12 10:39:49 | historyExample | 1 | ||||||||||||
4da63b6b-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | approvalUserTask:41ce0165-8ce5-11e9-8f69-8c16458a51a0 | 41cc0580-8ce5-11e9-8f69-8c16458a51a0 | approved | boolean | 1 | 2019-06-12 10:40:08 | 1 | 2 | 4da63b6a-8ce5-11e9-8f69-8c16458a51a0 | |||||||||||
4da6898c-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | approvalUserTask:41ce0165-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c95-8ce5-11e9-8f69-8c16458a51a0 | description | string | 1 | 2019-06-12 10:40:08 | Tamam | 2 | 4da63b6a-8ce5-11e9-8f69-8c16458a51a0 | |||||||||||
4da6d7ad-8ce5-11e9-8f69-8c16458a51a0 | VariableUpdate | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | approvalUserTask:41ce0165-8ce5-11e9-8f69-8c16458a51a0 | 41cc2c96-8ce5-11e9-8f69-8c16458a51a0 | versionTag | string | 1 | 2019-06-12 10:40:08 | 2 | 4da63b6a-8ce5-11e9-8f69-8c16458a51a0 | ||||||||||||
4da74cde-8ce5-11e9-8f69-8c16458a51a0 | FormProperty | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41ce2876-8ce5-11e9-8f69-8c16458a51a0 | approvalUserTask:41ce0165-8ce5-11e9-8f69-8c16458a51a0 | description | 2019-06-12 10:40:08 | Tamam | 3 | 4da63b6a-8ce5-11e9-8f69-8c16458a51a0 | |||||||||||||
4da74cdf-8ce5-11e9-8f69-8c16458a51a0 | FormProperty | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41ce2876-8ce5-11e9-8f69-8c16458a51a0 | approvalUserTask:41ce0165-8ce5-11e9-8f69-8c16458a51a0 | versionTag | 2019-06-12 10:40:08 | 3 | 4da63b6a-8ce5-11e9-8f69-8c16458a51a0 |
List historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(“41cb914f-8ce5-11e9-8f69-8c16458a51a0”).list();
historicActivityInstanceList result is [].
Thank you so much for quick response.
I think you might be using the wrong id - can you check the ACT_HI_PROCINST
table that will actually show you instances as well as their id’s
Hello,
I checked ACT_HI_PROCINST and there is a record also
select * from public.act_hi_procinst
where proc_inst_id_ = ‘41cb914f-8ce5-11e9-8f69-8c16458a51a0’
id_ | proc_inst_id_ | business_key_ | proc_def_key_ | proc_def_id_ | start_time_ | end_time_ | removal_time_ | duration_ | start_user_id_ | start_act_id_ | end_act_id_ | super_process_instance_id_ | root_proc_inst_id_ | super_case_instance_id_ | case_inst_id_ | delete_reason_ | tenant_id_ | state_ |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
41cb914f-8ce5-11e9-8f69-8c16458a51a0 | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | bpmnApproval | bpmnApproval:1:d6d85212-6b1f-11e9-988c-8c16458a51a0 | 2019-06-12 10:39:49 | 2019-06-12 10:40:09 | 19950 | startEvent | endEvent | 41cb914f-8ce5-11e9-8f69-8c16458a51a0 | COMPLETED |
How exactly are you making historical instance query?
As part of another process?
I’m calling my rest controller from react and controller calls this method.
@Service
public class ProcessServiceImpl implements ProcessService {
private final HistoryService historyService;
private final RuntimeService runtimeService;
public ProcessServiceImpl(HistoryService historyService, RuntimeService runtimeService, RepositoryService repositoryService) {
super();
this.historyService = historyService;
this.runtimeService = runtimeService;
}
@Override
public void getProcessDetailByProcessInstanceId() {
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId("41cb914f-8ce5-11e9-8f69-8c16458a51a0").list();
}
}
Niall!
It works now.
I do not know why but I closed then open spring tool 4 again and it worked. ^^
Thank you so much for helped me and spended your time for me
Thank you and Have a nice day.
Glad to hear it - i was getting close to suggesting turning something off and on again
hahahaha