Retrieve process variable by value or reference?

Hi,
While reading https://docs.camunda.org/manual/7.4/user-guide/process-engine/variables/ I am not shure how you retrieve a variable.
Do I get the variable by value or by reference?
Hence do I have to put the locally changed variable back to the process so that the following steps can access the changed variable?

Cheers,
Marco

Hi Marco,

Within one transaction, the object returned by #getVariable keeps its identity unless it is a primitive value. In addition, for variables of type object, the variable value is updated implicitly when the process engine command ends.

However, I recommend to use #setVariable explicitly whenever a value changes. The implicit variable value update has been error-prone in the past and there are still remaining issues, for example https://app.camunda.com/jira/browse/CAM-4805

Cheers,
Thorben

Hi Thorben,
Thanks for your fast reply and recommendation.
Cheers,
Marco