Hi @mabertran,
Thanks for sharing the additional information.
That the endEvent is not in the result of the query, is the expected behavior. When the process engine continues the flow of the process instance from the last transaction boundary until the end of the process instance, then these changes are not flushed to the database, when the process end execution listener is invoked.
You could try to use transaction listener:
public void notify(DelegateExecution execution) {
Context.getCommandContext().getTransactionContext()
.addTransactionListener(TransactionState.COMMITTED, new TransactionListener() {
@Override
public void execute(CommandContext commandContext) {
// perform your query to get all executed activities
}
});
}
This means, when the changes are committed to the database, then the transaction listener is invoked. In that case the query will also return the endEvent inside the results.
Disclaimer: This is internal API, meaning we do not guarantee any stability with upcoming releases.
Cheers,
Roman