AnsweredAssumed Answered

decision history with historic task

Question asked by p4w3l on Dec 28, 2012
Latest reply on Jan 3, 2013 by jbarrez
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 )

Outcomes