How to set variables on a called process instance?

niklaus: Hey guys, how do I know when a Call Activity is activated in my workflow? I’m using Go client.

korthout: Hi @niklaus Zeebe only offers a <https://docs.camunda.io/docs/apis-clients/grpc/|command API> for its clients. Generally, such data would be <https://docs.camunda.io/docs/components/zeebe/technical-concepts/architecture/|exported to an external system> like ES, and then consumed by https://docs.camunda.io/docs/components/operate/|Operate/https://docs.camunda.io/docs/components/tasklist/introduction/|Tasklist/https://docs.camunda.io/docs/components/optimize/what-is-optimize/|Optimize or by your own application. Does that help? If not, please explain in some more detail what you want to achieve and why

niklaus: @korthout I want to use SetVariables RPC API to set some variables for the subprocess scope only. As you know, Zeebe will automatically create a process instance when the subprocess (Call Activity) is activated. I want to set some variables like {“foo”: “Hello world”} that’s visible to the subprocess scope inside Call Activity only. I haven’t figured out how to do that yet.

korthout: Aha, that makes sense. Luckily there are some other ways to do this:

• <Variables | Camunda Cloud Docs mappings> on the<Call activities | Camunda Cloud Docs call activity>, if you have the variables already available in the parent process or can calculate the values using variables in the parent process
• use a <Service tasks | Camunda Cloud Docs task> at the start of the child process and let the job worker complete the job for that task with the related variables.
• if the data for the variables is potentially only available in your own systems before the call activity is activated, then you can use a <Messages | Camunda Cloud Docs message> to sent the data and receive it in the child process using an https://docs.camunda.io/docs/components/modeler/bpmn/message-events/#intermediate-message-catch-events|intermediate<Message events | Camunda Cloud Docs message catch event>.
I hope this helps. Let me know if you have any questions :+1:

Note: This post was generated by Slack Archivist from a conversation in the Zeebe Slack, a source of valuable discussions on Zeebe (get an invite). Someone in the Slack thought this was worth sharing!

If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs.

@jwulf Seems the archivist has some trouble with the link format that I used in this slack conversation. Please let me know if I can open an issue for this somewhere.