cancel
Showing results for 
Search instead for 
Did you mean: 

how to find out if a process threw error event

workflowuser2
Champ in-the-making
Champ in-the-making
Hi,
I have a subprocss with error boundary event. In the event when a BPMNError is thrown, error boundary event is activated and the subprocess is cancelled.
Is there a quick way (direct API) to find out if process went through happy path (no error event) vs the case when an error event was thrown?

Thanks,
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
You could leverage the history for this, I can think of two approaches:

  • Use a different end-event for your process in happy-path and stuff-hit-the-fan-path. You can use minimal history level to inspect "endActivity" on the historicProcessinstance.

  • Set history level high enough to have HistoricActivities available… You should inspect all the activities for the process-instance to see if the error-related stuff is in there.

workflowuser2
Champ in-the-making
Champ in-the-making
Thanks  frederikheremans.
As always, very useful reply.
I thought there might be quicker/direct way to do this. Neverthless, your solution is good.



You could leverage the history for this, I can think of two approaches:

  • Use a different end-event for your process in happy-path and stuff-hit-the-fan-path. You can use minimal history level to inspect "endActivity" on the historicProcessinstance.

  • Set history level high enough to have HistoricActivities available… You should inspect all the activities for the process-instance to see if the error-related stuff is in there.

workflowuser2
Champ in-the-making
Champ in-the-making
Hi frederikheremans,

I am trying your suggested approach (1st). I have two different end events.

In my test class:
public class Test extends PluggableActivitiTestCase {
// start process

// wait to be complete
List<HistoricProcessInstance> processHistory = historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).list();
    for (HistoricProcessInstance history : processHistory ) {
     System.out.println("history" + history.getEndActivityId());
    }

}

In the above test case, I am always getting end activiti id as null.
Is it because I am running unit test? When is endActivity set?

Thanks,
pdt
Thanks  frederikheremans.
As always, very useful reply.
I thought there might be quicker/direct way to do this. Neverthless, your solution is good.



You could leverage the history for this, I can think of two approaches:

  • Use a different end-event for your process in happy-path and stuff-hit-the-fan-path. You can use minimal history level to inspect "endActivity" on the historicProcessinstance.

  • Set history level high enough to have HistoricActivities available… You should inspect all the activities for the process-instance to see if the error-related stuff is in there.

workflowuser2
Champ in-the-making
Champ in-the-making
Please ignore my previous reply.
I needed to set cancelActivity="true" on the error boundary event.

pdt