Is it possible to return the processInstanceKey when starting an instance via API?

Greetings everyone,

I’m using a webhook to start a process instance, I need to return the processInstanceKey after starting the instance, how can I do this?

Hi @Domingos_Dias - have a look at the correlation variable that is available in the response expression:

Hi @nathan.loding!
Thanks for your response, but I don’t understand how passing the fixed value of the processInstanceKey can help in practice, the processInstanceKey is a dynamic value that can change under certain circumstances, so it is not practical to pass it statically in the response

@Domingos_Dias - the code blocks are examples of what the correlation variable contains; you aren’t setting it, the engine is. So for the start event example, you can set your response expression to something like:

  processInstanceKey: correlation.processInstanceKey,
  message: "Process started successfully"
1 Like

Thank you, that’s exactly what I was talking about

Why do I get this back:

  processInstanceKey: null,
  message: "Process started successfully"

I don’t understand what you mean

I did the same as you did, but my webhook message start even connector returns a null instead a processInstanceKey.
My response body expression:

= { 
  processInstanceKey : correlation.processInstanceKey,
  message : "Process started successfully"

Ok found my problem, I needed to upgrade the webhook connectors to v10. I was using v8.
Thnx for this important insight.


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