'$' vs '#' usage in expressions

The symbols were confusing whether to use ‘$’ or ‘#’ in expressions.

Lets say i have a process variable “assignee”, in bpmn file should i have to mention ${assignee} or #{assignee}.

In forums, i saw many of them posted using ‘#’ in expressions.

Which one is valid and when to prefer one against another?

1 Like

Hi @aravindhrs,

According to the EL documentation, ‘$’ is used for immediate evaluation, while ‘#’ for deferred evaluation. The latter means that the technology using the expression (here the Camunda engine), can evaluate it at a later stage/phase.

Since expressions in Camunda are evaluated during runtime, when the execution containing the expression is executed, it is best to use ‘$’ for expressions.

Cheers,
Nikola

5 Likes

You can always use $. # is the value of the variable being passed. So if “Bob” is the assignee, #{assignee} or ${assignee} is the same as #{bob} or ${bob}. Where if I am trying to determine some like is x > 12, you have to use $.

2 Likes