Variables vs input/Output

Hi,
I am bit confused about process variables vs input/output adding in camunda modeler. May I know exactly what is the difference.

  1. execution.setVariable(“prodUrl”, “https://localhost:9090”);
  2. Adding same variable in camunda moduler input/output parameter.

What is the difference using these 2 ?

Hi @vinothkumar

  1. execution.setVariable(Variable name, Variable value) can be used to set a variable .

The variable created will be accessible throughout the process by any element for a particular instance.

  1. Passing variables to an element via input mapping creates a local variable that is only accessible for the execution context of the element it is passed to and deleted once the execution continues.

For the output mapping, it creates a new global variable that can be accessed freely after creation, until the process instance is finished.

You can check the below link to find more about input/output mapping and process variables.

https://docs.camunda.org/manual/7.5/user-guide/process-engine/variables/

Regards,
Anmol