Get process instance variables and business key with filter criteria "embedded subprocess variable"

Hi Camunda Community,

I am currently struggling with a selection on a running process instance.
The process instance has an embedded multi-instance subprocess and is waiting in an intermediate receive message event.

Now I need the buisiness process key and some process instance variables and all I have is the name and value of a process instance variable that is assigned to one instance of the embedded subprocess. The variable is like:

        "type": "String",
        "value": "4711",
        "valueInfo": {},
        "id": "28af6499-8f57-11e8-a493-fc084a69ea91",
        "name": "organizationId",
        "processInstanceId": "ef1dd8e2-8f56-11e8-a493-fc084a69ea91",
        "executionId": "28af3d86-8f57-11e8-a493-fc084a69ea91",
        "caseInstanceId": null,
        "caseExecutionId": null,
        "taskId": null,
        "activityInstanceId": "my-embedded-subprocess:28af8bac-8f57-11e8-a493-fc084a69ea91",
        "errorMessage": null,
        "tenantId": null

Is there a way to archive this with the java api, like…

… give me the business key and variable value of variable x of the process instance that is waiting in a subprocess “my-sub-process” at a messeage receive event with name ‘message_response_organization’ and has a sub-process-variable organizationId with value 4711.

Giving up for today…
…any input highly appreciated

Hi Kristian,

I don’t think you can achieve that with only one request.
The reason is that business key is info related to the process instance and the variable value are related to variable instance.

Best regards,