Pass variables to different processes using call activity

How to pass data from one Process to another in code .I am using Spring Boot in Java code.

enter image description here

When using a call activity, there is no implementation needed to call the other process. Camunda takes care of this. You can use the properties In/Out mappings and In/Out mapping propagation to set variables. You can read more in our documentation:

Well my question is not related to calling other process.I am able to call Process 2.
I have below variable in my Process 1 which i am setting in JavaDelegate execution
I want to pass these to Process 2.How to do it in Java .Documentation doesn’t isnt that helpful

Variables in execution.setVariable of Process 1
a) var_1 (STring)
b)List billNUmberList
c) var_2 (int)

The first service task creates the variable.
Then you reach the call activity, and you can call Process 2 you can pass all the variables that are needed to process 2 by configuring the call activity.
Process 2 is executed, and you can configure the call activity so that variables are passed back to process 1. This is explained in the documentation.

Doing it from java is considered unclean. You introduce dependencies between your models, that are not visible in the process model. Alternatively, you can add explicit message flow (which is clean again). With messages, you can send variables from one process to another.

If you insist on doing it in Java without call activities and without messages, you can use the runtime service:
https://docs.camunda.org/javadoc/camunda-bpm-platform/7.18/org/camunda/bpm/engine/RuntimeService.html
As mentioned before, this is not recommended.

@StephanHaarmann how to implement it?Documentation is pretty bad.It just shows xml.
How to do it modeler?and how do i read those values in Process 2?And i necessarily dont want to do it in Java if thats a bad practice .

All properties that are mentioned in the documentation, can be found in the properties section of the modeler.
If you set the flag In mapping propagation>Propagate all variables, all variables of Process 1 will be copied to process 2:


If you want to be more specific, i.e., select variables that are accessible and choose their variable type, you can use in mappings:
image
Out mappings and Out mapping propagation fulfil the same purpose in the other direction, i.e., passing variables from process 2 to process 1.

1 Like