Introduction
Back end expressions are a tool to get or set variables during the execution of processes, cases, or decision tables. Back end expressions can also be used to implement custom logic or to delegate that logic to a Java service deployed on the server. Examples of using expressions usage are setting dynamic task names, evaluation of sequence flows after a gateway, or create a variable of a certain type. As the name implies, these expression run on the back end, during execution. As such they have no access to the frontend data at the time of evaluation.
In Flowable Design, expressions are allowed in fields marked with a lightning bolt: .
Flowable uses the Unified Expression Language (UEL) for resolving expressions.
The documentation for UEL is a good reference for syntax and available operators.
Each expression starts with ${
and ends with }
.
There are two types of expressions:
-
value expressions provide a value. Supported values include Boolean, string, integer, floating-point number, and null. A typical value expression is
${variable.property}
or${bean.property}
. -
method expressions invoke a method with or without parameters. An example of method expression is
${bean.setPropertyValue('newValue')}
. To distinguish between a value expression and a method expression without any parameters, use empty parentheses at the end of the method call. For example,${variable.toString()}
.
In theory, any Spring bean exposed to the application is available for use in backend expression, but not all classes can be serialized in a way which will allow for a proper expression evaluation.
Certain expressions are available in scripts (e.g. for use in a BPMN or CMMN script task). A list of expressions which can be used is available as part of the backend scripting documentation.
Keywords
The process and CMMN engines support context-dependent objects.
Both engines resolve hierarchy objects like root
and parent
and can be used to access their local properties. root
stands for the object on the top of the execution hierarchy, which can be a process instance or case instance.
parent
is a reference to the first process or case instance immediately above the current object in the hierarchy.
For process instances and case instances definition
grants access to the definition and all its attributes.
In the context of BPMN execution, additional reserved keywords are execution
and authenticatedUserId
.
-
execution
references to the current 'path of execution' or 'token'. It provides access to properties likename
,businessKey
,processDefinitionId
, andparentExecution
(technically, it is backed by the ExecutionEntity class). -
task
is a reference to the current task (technically, it is backed by the TaskEntity class). -
authenticatedUserId
is a string identifier of the currently authenticated user. If there is no authenticated user, the variable is not available.
The CMMN engine context supports task
(see above), caseInstance
, and planItemInstance
.
-
caseInstance
references to the current case instances. It provides access to properties likename
,state
,businessKey
,caseDefinitionId
, andparentId
(technically, it is backed by the CaseInstanceEntity class). -
planItemInstance
references the plan item instance associated with the case.