How can I get parent's process instance id from call Activity (sub-process)

Hello. I need to get the parent process instance id inside my Call Activity (sub-process). Are there any native ways to do that? Of course, I can set it to Call Activity’s Input section like “rootProcessInstanceId”. But may be there is another solution? I want to get this Id from one of my workers, but I can’t find suitable method in spring-zeebe-starter.
image

Снимок

Снимок

Hi @vilgodskiy_sergey :wave: and welcome!

Currently, this data is not provided along with an activated job. Can you please explain your use case?

@korthout Thank you for your answer! My use case:
I have several user’s tasks in different Call Activities and I need to know that those user’s tasks are related to one root process. Now I pass generated UUID (give it name “rootProcessInstanceId”) during start root process and then pass this variable to each Call Activities. With this property I can resolve my issue. But I thougt may be Camunda Cloud has some native ways to resolve it, like in Camunda Platform we have rootProcessInstanceId. Or at least I can make this property be sent to each Call Activities without setting them to Input Section.

2 Likes

Thanks for providing your use case @vilgodskiy_sergey. Your current solution (using a process instance variable that is passed into the called instances) is the recommended way. Note that you can control which variables are passed into the called instance using variable input mappings on the call activity.

We’ve been thinking about a solution to provide such data in a non-intrusive manner, but the concept has not been fleshed in detail and is not planned for the foreseeable future. If you believe it’s important to be able to access process instance-related data inside the process instance itself, then please create an issue for it. This allows the team to adjust our plans if needed.

1 Like