Can't map call-activity-variable to local-variable

Hi,

my process has a sequential multi-instance sub-process, which contains a call-activity. The result of the call-activity should be mapped to a local variable. I tried to achieve this by using the variables-in/out-mapping and a delegate-variable-mapping – without success.

I created a spike: https://github.com/holunda-io/holunda-spike/tree/master/callactivity-local-variable-mapping

Maybe someone can tell how to solve this problem.

Thanks in advance and best regards
Christian

Hi @maschmann,

you have to configure the variable mapping in the call acitvity. If you set the local checkbox in the modeler to true, the variables are passed to the execution of the call activity: https://docs.camunda.org/manual/7.11/reference/bpmn20/subprocesses/call-activity/#combination-with-input-output-parameters

Hope this helps, Ingo

Hi @Ingo_Richtsmeier,

Thanks for your answer.

I tried it out: Removed the delegate-variable-mapping and used the variables-panel. In the panel I defined the in parameter as source “element” -> “element” without local checked and the out parameter as source “result” -> “result” with local checked. The result: no “result” variable in the execution, neither in the normal variables-map nor the variables-local-map.

The change is pushed to the spike. Maybe I did something wrong and you can have a look at it?

Thanks in advance,
Christian

Hello @maschmann

  1. In MainProcess.bpmn file, uncheck Local from Out Mapping of result

    As checking local means that variable would be mapped to local variables of the execution of the call activity, not the calling process. That’s the reason we don’t see the result as part of local variable list once call activity ends, instead it is available as process instance variable.

  2. If you have a use case where in you need “result” as a part of local variable of calling process instance, then you would need to change the type of “result” from process instance to local. This could be achieved by defining it as a local variable before call activity is called. For example:

    execution.setVariableLocal(“result”, “initialvalue”);

    Please let us know if it works.

Hi @garima,

thanks for the help.

Declaring the local variable before the call activity works. For a workaround it’s okay.

Best Regards
Christian

1 Like