How to historically get all the activities linked to a sub process

Hi Team,

"
process
sub process
/sub process
/process
"

Now, i see in runtime execution there is a link between the subprocess execution id and parent process execution id and all the execution of sub process.

But how can i get the history of activities for a given sub process execution id without using the runtime execution tables as runtime execution are cleared when the task completed

thanks in advance

Hey @senthacit,
take a look at this part of the documentation HistoryService (Flowable - Engine 6.8.0 API).
You can call the history service like this: List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).list();

Greetings

Christopher

hi @WelschChristopher ,

Thanks for the suggestion.

But i need to get the historic activity instance for a given execution id. where the execution id is parent and it has child executions also

We have an urgent issue to be fixed. can anyone help here.

If you want to query based on the execution ID, you can also use the historyService.

But i need to get the historic activity instance for a given execution id.

As documented in the provided link, you can query by executionId.

historicActivityInstances = historyService.createHistoricActivityInstanceQuery().executionId("yourExecutionId").list();

But i need to get the historic activity instance for a given execution id

Be aware that this will be a list of HistoricActivityInstances. Iterate over the list and find your call activities. The call activites will provide you with the calledProcessInstanceId. That way, you get your new subProcess.

What do you use in your model? SubProcesse or CallActivity?

hi @WelschChristopher ,

historicActivityInstances = historyService.createHistoricActivityInstanceQuery().executionId(“yourExecutionId”).list();

above will only give the the execution with that specified id and not all the child executions of that id.

I have it as subprocess, i am not using it as call activity.

Only using the execution id how can i get the sub child executions

@WelschChristopher please let me know thanks

Hey,
with your executionId, you get the activities and extract the process instance id. With the processInstanceId you query all activities of that process (that includes the subprocess executions).
Iterate over that list and group them by executionId.

Greetings

Christopher

I have it as subprocess, i am not using it as call activity.

I have it as subprocess, i am not using it as call activity..

.

Hey @beedcons
the explanation is for subprocesses.

Greetings

Christopher

I have changed it to use the Call Activity instead of sub process and was able to solve it using the super process instance id column in history activity instance table.

There is trouble using embedded sub process, so used the call activity which was better to handle.

Thanks