AnsweredAssumed Answered

Get execution id to signal a receiveTask in a subprocess

Question asked by joachimvda on Jun 8, 2012
Latest reply on Jul 15, 2016 by borovinskih

I have a workflow which contains a subprocess (embedded). This subprocess contains a receiveTask.

I am writing a junit test in which I want to signal that receiveTask.
In my process I have set the businessKey when creating the process and I also have a process variable which contains that business key.

I cannot find a way to get the correct execution id to assure that the signal succeeds.

My first try was

but this causes a NPE as this return the process id of the parent process, not the subprocess.

I tried searching by doing a query on the super process:
ProcessInstance parentProcess = runtimeService.createProcessInstanceQuery()
        ProcessInstance subProcess = runtimeService.createProcessInstanceQuery()
        Execution execution = runtimeService.createExecutionQuery().

Unfortunately this fails as the superProcessInstanceId query returns no results.

The only way I found to find a working execution is using

This obviously has the problem that I have a problem figuring out the correct execution if there is more than one.

What is the suggested way to find the correct execution object?

I am using 5.10-SNAPSHOT (as I am also using designer 5.9.2 and 5.9 does not recognize the .bpmn flows).