Copy Variables From call activity task to main process

Hi,
I want to copy all the variables from my Call Activity Task to my main process. Is their a shortcut to copy all the variables from call activity task to main process or i need to manually enter all the variables(around 150-200) in Out Parameters section.

No, that is currently not possible … but it would be a nice feature.

The quickest way right now would be to subclass the CallActivityBehaviour and override this method: https://github.com/flowable/flowable-engine/blob/master/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CallActivityBehavior.java#L225, where you can copy all the variables of the parent execution into the newly created execution.

1 Like

Hi Joram,

Thanks, will try this :+1:

Thanks,
Arpit Agrawal

Hi,

For copying all variables from the main process to the sub process there’s already the inheritVariables attribute on the callActivity element you can use. For copying back all variables from the sub process to the main process there’s no attribute yet. It’s also a bit dangerous, because it could overwrite existing process variables.

Best regards,

Tijs

Hi,

I was using In-Parameters and i noticed that if i give a variable in In-Parameter but if that variable doesn’t exist in the process from where i am calling the call activity process, it creates that variable but set is value to null. Can you tell me why it was necessary to make that variable in the child process and set its value to null because if i do fetch all variables from child process and do processVariables.getOrDefault(variableName, default).“ANY_FUNCTION_CALL_THAT_IS_POSSIBLE_ON_THAT_VARIABLE_IF_IT_EXISTED” it gives that variable also with value null and it creates null pointer exception. So now i have to check that if that variables exist &, is not null then do the processing i need to do. So, just wanted to know, why it was created this way.

Thank You,
Arpit