Passing task name of Call Activity into the subprocess

I have a main process which has a Call Activity. In the called subprocess I want to pass dynamically the task name.
The way I did it is to create an Input parameter and set manually the default value with the Call Activity name.

I would like though to pass it dynamically (since I may change the name of the parent Call activity and forget to change the Input parameter. Also I may use this Call Activity many times).
What I tried is to create a start Execution Listener in the Call activity to catch the task name into a process variable:

Then, I pass this variable to the default value of the Input parameter:
calldyn

But this doesn’t work. The identifier in the default Input variable is not recognized. I guess it’s because the Execution Listener has not been executed already.
Any ideas?

Thanks

Hi @kontrag,

To achieve this I did the following:
In Call Activity listener:
execution.setVariable("current_activity_name", execution.getCurrentActivityName());
In variables mapping of the Call Activity:
In Mapping / Source / Target set to current_activity_name

image

2 Likes

Hi @Ilya_Malyarenko,

I see we use the same execution listener.
But for the Mapping I use type “All”. Shouldn’t it work for all variables?
Shall I just use 2 In mappings, one with all and one as you suggest? No conflicts?
Should the target variable exist also in the subprocess or it is created automatically?

Thanks!

Hi @kontrag,

I don’t have precise answers for your question as started experimenting with Call Activity yesterday :slight_smile:

Best regards,
Ilya

I just tried it. Indeed, you need a same variable in the local process with the same name (target) and it works!