How to reference process instance id in modeler?

I have a “Receive Task” node in the modeler, and want to use process InstanceId as the correlationKey, but can’t find how to get this variable.
Is there any way to access this variable?
Thanks.

Hi @marvinmu,
By default, process instance key is not available as process variable.
we need to set that process variable using script task once the process has started.

long instanceKey = job.getProcessInstanceKey();
        Map<String, Object> variables = new HashMap<>();
        variables.put("correlationKey", instanceKey);

        client.newCompleteCommand(job.getKey())
              .variables(variables)
              .send()
              .join();

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.