As far as I can see and the features we are using with the Modeler now, User tasks can be Canceled in two ways. First, if a timer boundary event is added to a User task and it times out before the User task was completed. And second, if the Process that the User task is connected to was deleted from the Cockpit while the User task was active.
In both these cases, User task appears Cancelled on Camunda History.
I am preparing a batch job related to User tasks and I need to know for what reason the User task was Cancelled.
What I found the closest to the need is ActivityState values.
var activityInstanceId = historyService.createHistoricTaskInstanceQuery() .taskId(taskId) .singleResult() .getActivityInstanceId(); var activityInstanceState = ((HistoricActivityInstanceEntity) historyService .createHistoricActivityInstanceQuery() .activityInstanceId(activityInstanceId) .singleResult()).getActivityInstanceState();
There is an explanation for ActivityState values:
// ActivityState values // 0: default // 1: scopeComplete // 2: cancelled // 3: starting // 4: ending
- In which case, which ActivityState value occurs, can you give more detailed information?
- If activityInstanceState == 2, how can I find out whether the User task was Canceled because the timer boundary event or the Process belonging to the User task was deleted?
- How would you do if it were you? How can I find out what happened to the User task by looking at the History service?