AnsweredAssumed Answered

Process not query-able immediately after it started

Question asked by ekolesnikov on Jun 20, 2014
Latest reply on Jun 20, 2014 by trademak
Hi all,

Just found this weird thing: if there is a sub-process, or parallel execution, it appears that process instance / execution queries return null up until the process reaches its first wait state.

I.e. I have the following code in my sub-process' Java Service Task:

      RuntimeService rs = execution.getEngineServices().getRuntimeService();
      String processInstanceId = execution.getProcessInstanceId();
      ProcessInstance parentProcess = rs.createProcessInstanceQuery().subProcessInstanceId(processInstanceId).includeProcessVariables().singleResult();

The sub-process diagram is quite simple:

The problem here is that without that intermediary timer event, the query above will return null for parent process. With the timer, everything appears to be working properly.

It looks like the task execution happens in a separate database transaction - hence the lack of visibility. Is this correct behaviour?