cancel
Showing results for 
Search instead for 
Did you mean: 

decision history with historic task

p4w3l
Champ in-the-making
Champ in-the-making
I am looking for a best approach to display a list of finished tasks for a given process instance with a decisions results. It is clear for me how to get a list of finished tasks:

historyService.createHistoricTaskInstanceQuery()           .processInstanceId( getTask().getProcessInstanceId() )           .finished()           .orderByHistoricTaskInstanceEndTime()           .desc()           .list();‍‍‍‍‍‍‍‍

But when one of the tasks sets a process variable - next used in a gateway - I cannot see 'compact' way to display the decision history apart to historic task list.

The workarround I used today are different two ( or more ) tasks next to gateway - even if they are not needed - just to name one as "approved" and second "not approved". Then I have a 'decision' in finished task list got in above query. This workarround doesn't satisfy me and I am looking for something better.

The second approach that seems to be promising is to take historic activities like that:
historyService.createHistoricActivityInstanceQuery()        .processInstanceId( getTask().getProcessInstanceId() )        .finished()        .orderByHistoricActivityInstanceStartTime()        .desc()        .list();‍‍‍‍‍‍‍‍

Unfortunately activity id <> task id, so it is difficult to get task details having activity id.

Questions:
1. What is the recommended approach to get decisions apart to finished taks of a process instance in the form of task list?
2. How to get task id from activity id ( just in case second approach is the best ) ?
3. How to get details for activity type 'xxxxGateway' - result of the decision ( = process variable )
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
1. What is the recommended approach to get decisions apart to finished taks of a process instance in the form of task list?

I would use the historic variables for that. The variable then contains the value at the time of the decision

2. How to get task id from activity id ( just in case second approach is the best ) ?

That won't be possible a task is something else then an activity. You'd need to know the name of the activity when querying, which is not a good thing

3. How to get details for activity type 'xxxxGateway' - result of the decision ( = process variable )

  HistoricDetailQuery createHistoricDetailQuery(); on the historyService is what I would try first.