Call activity parent process instance ID

Hi, I’m using the “camunda-external-task-client-js” node module, my node instance is subscribed to a process instance’s task running on my server and gets a call back to complete that task, aka the handler.

Within this process instance’s task, I use a “call activity” to call/invoke another process instance. When that happens, how do I know the child instance, or “call activity” process instances, parent ID?

Can I arrange to somehow get the same ID no matter what, even if I am getting a call from a call activity, I need to know what ROOT/parent business process I am getting called by?

I need to know which process instance is invoking the nodejs while I am in a child instance to control the flow of my operations within nodejs.

I LOVE the “call activity” notion because I want, at each level, for the process diagram to be simple and understandable, and having re-usable processes could be key to making it easy to assemble chatbots out of processes.

Also, from the rest API (and, in particular, the camunda-external-task-client-js) can I set variables on the process instance or even the root process instance that can be seen from the task in the call activity sub process? That might be an easy way to solve the above problem.

Where is task.variables.set setting? I seem to be able to branch on the settings I make using it so is it setting on the process instance? I’m a little confused about this.
Thanks again for all your help!

Hi Tristan-D-19.

I think the easiest way to solve this is to set a business key (or some special process variable like a trace_id) on the process instance and pass this on to every called process instance (this is described in the docs how). This way you can have one id that identifies the whole call chain.

I don’t understand your question around the ‘task.variables.set’ - sorry. Probably rephrase it?

Cheers
Bernd

I don’t know HOW to pass down the biz key. I am just using the “Call Activity” task type to invoke the sub workflow process and I don’t have any obvious hook to pass the key down to the child (or grandchild) biz process. How would I do that, specifically? Do I need to write Java code to do it? Is there something I can put right into the bpmn or something that is easy for a nodejs programmer to do?

I could, I guess, not use “Call Activity” but use a Service Task and have my nodejs code start up the sub processes. Would you recommend I do that? It does not sound like it would be hard to do that. I don’t know enough to know what problems using “Call Activity” solve beside that it is a standard for how to run a sub business process.

Nothing too tough - just a ticking the business key box will do the Trick

1 Like

See also the docs: https://docs.camunda.org/manual/7.8/reference/bpmn20/subprocesses/call-activity/#passing-business-key

2 Likes

I am able to use submit (from camunda-bpm-sdk-js) to start a biz process and set its businessKey. From inside of my code (which uses camunda-external-task-client-js) I don’t know how to READ that value. How do I do that? Do I need to do an extra ajax call to get it? If so, exactly how?

And will it work the same way in a sub process, whatever that is? It is for the Call Activity’s tasks that I really care about.

On a related note, I’d love to be able to use signal to start potentially more than 1 process and still be able to arrange for them to have a biz process key, perhaps they could end up with a unique number added to the end: bizKey001, bizKey002…

So does that mean the parent process and callactivity process don’t share anything in common? Or Is there any id which defines the whole process as one?

You can see the parent process id when the process was called by a parent. That allows to see the whole hierarchy (as we do in Cockpit). But there is indeed not a single ID shared, but you can use the business key or a process variable for that

1 Like

Thanks Bernd. Yea, businesskey helped in my case.