While migrating from Activiti to Flowable, we have observed the following behavior difference:
In an event listener we handle the PROCESS_COMPLETED event. There we are interested in the end event which caused the process instance completion.
We access the process instance by (ProcessInstance) entityEvent.getEntity(). Previously, the getActivityId() function of the process instance delivered the id of the event of interest. Now, we get null.
In addition to that, the following queries also deliver null:
That’s indeed correct: the fact that the process instance had one activity was incorrect (a process instance can have multiple active activities, e.g when there’s parallel paths and such). In the v6 architecture, a process instance is a separate entity and it’s child executions are the ones that have an activity in which they’re currently in.
To get the data you want, you can get the child executions (through getExecutions()) and then execute getCurrentFlowElement() to get all current elements where the process instance is currently at. One of them will be the end event.
Unfortunately, we couldn’t proceed further, as the getExecutions method called on the ProcessInstance cast to ExecutionEntity delivers an empty list. Please note we are in an event listener handling a PROCESS_COMPLETED event.