Create global variable process using java code

Hi Team, we have a requirement to create a few global process variable using java code so that we can can use these variables globally to any of the node.

Could you please guide some of the approach to achieve the same.

BPMN & Modeling Discussion & Questions Camunda 8 Topics Camunda Academy

Hi @uddeshya_pratik - there are two primary ways to do this:

  1. When you start a process instance, pass in the variables, and they will be available to tasks in your process.
  2. Use the SetVariables gRPC endpoint, where you can set variables on the process instance instead of a specific task
1 Like

Hi @uddeshya_pratik

An extra option if you prefer to go with the Unified REST API is to use the endpoint
/element-instances/:elementInstanceKey/variables

1 Like