Process Instance with null Process Definition Key

Dear Flowable experts,

we have observed the following behavior in our application. In a JavaDelegate extension and in Flowable Event Listeners we have, we query for the process instance of interest with the following query (or equivalent):

ProcessInstance processInstance = processEngineConfiguration.getRuntimeService().createProcessInstanceQuery()
                .processInstanceId(execution.getProcessInstanceId()).singleResult();

For some occasions, the ProcessInstance object returned contains a proper processDefinitionKey, for the others - not. As we need the processDefinitionKey in our scenario, we are forced to make an additional ProcessDefinitionQuery.

Is it an expected behavior that the processDefinitionKey of a ProcessInstance is not always in place? If yes, could you maybe give some guidance on when we could expect it and when not?

Thank you!

Best regards,
Vasil

We have the same issue, not glad to see this problem unanswered

Hi @donkon,
Unfortunately, we haven’t found the root cause for the problem and stayed with the approach where additional query is made.
Best,
Vasil

Hi Vasil,

yes

All db operations are made before transaction is committed. (Operations are optimized too). That’s why db query returns null processInstance your code is invoked between startEvent and the first wait state. Up to date processInstance can be accessed from execution in java delegate, without db query

Regards
Martin

1 Like