No Activity ID by PROCESS_COMPLETED Event

Dear experts,

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:

  • historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).singleResult();

  • runtimeService.createActivityInstanceQuery().processInstanceId(processInstance.getId()).singleResult();

Is it a bug or expected behavior? What would be a way for us to access the end event id of interest?

Thank you!

Best regards,
Vasil Tsimashchuk

I have also noticed that the variables are also not accessable for the same PROCESS_COMPLETED event using (ProcessInstance) entityEvent.getEntity() like you have.

Thanks for the info! we’ll take it into account. Let’s wait for the comments from the Flowable developers.

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.

1 Like

Hi Joram,

thank you very much for the clarification!

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.

Do we miss something?
Thank you!

Best regards,
Vasil

In addition to that, what is the meaning of the endActivityId and wouldn’t it be possible for us to utilize it in our use case? (as of now, it’s also null)