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 expressions 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.
-
executionreferences 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). -
taskis a reference to the current task (technically, it is backed by the TaskEntity class). -
authenticatedUserIdis 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.
-
caseInstancereferences to the current case instances. It provides access to properties likename,state,businessKey,caseDefinitionId, andparentId(technically, it is backed by the CaseInstanceEntity class). -
planItemInstancereferences the plan item instance associated with the case.
When a process or case instance is deployed within a Flowable app, the flowApp keyword is available in both BPMN and CMMN contexts.
flowAppprovides access to app-level variables (e.g.${flowApp.customerName}) and to the app definition via${flowApp.definition}(e.g.${flowApp.definition.key}). See App Expressions for more details.
Reserved Variable Names
Flowable reserves a number of names at the task, process, case, and expression layers. Using any of these as a custom variable name can lead to unexpected results. The lists below are a non-exhaustive set of names to avoid when defining custom variables.
For form related list of reserved words see the Form Editor reference — Binding.
Task Properties
| Variable | Task property |
|---|---|
id | Task ID |
name | Task name |
description | Task description |
state | Task state |
owner | Task owner |
assignee | Current task assignee |
delegationState | Task delegation state (PENDING / RESOLVED) |
priority | Task priority |
category | Optional tag classifying the task |
formKey | Form reference for the task |
dueDate | Task due date |
suspended | Whether the task is suspended |
createTime | Task creation time |
startTime | Task start time |
endTime | Task end time |
claimTime | Time the task was claimed |
claimedBy | User who claimed the task |
completedBy | User who completed the task |
inProgressStartTime | Date/time when the task was put in progress |
inProgressStartedBy | User who put the task in progress |
inProgressStartDueDate | Due date while the task is in progress |
parentTaskId | Parent task ID for sub-tasks |
parentTaskName | Parent task name |
executionId | Execution ID owning the task |
processInstanceId | Process instance ID |
processInstanceName | Process instance name |
processDefinitionId | Process definition ID |
processDefinitionName | Process definition name |
processDefinitionCategory | Process definition category |
caseInstanceName | Case instance name |
caseDefinitionName | Case definition name |
caseDefinitionCategory | Case definition category |
taskDefinitionId | Task definition ID |
taskDefinitionKey | ID of the activity in the process defining this task |
scopeId | Scope ID |
subScopeId | Sub-scope ID |
scopeType | Scope type (bpmn, cmmn, etc.) |
scopeDefinitionId | Scope definition ID |
tenantId | Tenant ID |
permissions | Permissions for the current user |
translations | Translation values |
Process Instance Properties
| Variable | Description |
|---|---|
id | Execution ID |
processInstanceId | Process instance ID |
name | Process instance name |
businessKey | Process business key |
businessStatus | Business status |
businessStatusLabel | Translated business status label |
suspended | Whether the process instance is suspended |
suspensionState | Suspension state |
isActive | Whether the execution is currently active |
ended | Whether the process instance has ended |
completed | Whether the process instance has completed |
activityId | Current activity ID |
startActivityId | Starting activity ID |
startTime | Process start time |
endTime | Process end time |
startUserId | User who started the process |
assignee | Process assignee |
owner | Process owner |
dueDate | Process due date |
claimTime | Time the process was claimed |
claimedBy | User who claimed the process |
callbackId | Callback ID |
callbackType | Callback type |
referenceId | Reference ID |
referenceType | Reference type |
parentId | Parent execution ID |
superExecutionId | Super execution ID for call activities |
rootProcessInstanceId | Root process instance ID |
propagatedStageInstanceId | CMMN parent stage instance ID for executions inside a case stage |
processDefinitionId | Process definition ID |
processDefinitionKey | Process definition key |
processDefinitionName | Process definition name |
processDefinitionDescription | Process definition description |
processDefinitionCategory | Process definition category |
processDefinitionVersion | Process definition version |
processDefinitionDeploymentId | Process definition deployment ID |
deploymentId | Deployment ID |
tenantId | Tenant ID |
permissions | Permissions for the current user |
translations | Translation values |
Case Instance Properties
| Variable | Description |
|---|---|
id | Case instance ID |
name | Case instance name |
businessKey | Case business key |
businessStatus | Business status |
businessStatusLabel | Translated business status label |
parentId | Parent case instance ID |
state | Case instance state |
completed | Whether the case has completed |
completeable | Whether the case can complete |
started | Time the case started |
startTime | Case start time |
ended | Time the case ended |
startUserId | User who started the case |
startedByUserId | User who started the case |
lastReactivationTime | Last time the case was reactivated |
lastReactivationUserId | User who last reactivated the case |
assignee | Case assignee |
owner | Case owner |
dueDate | Case due date |
claimTime | Time the case was claimed |
claimedBy | User who claimed the case |
customViewKey | Custom view key |
agentInstanceId | Agent instance ID |
callbackId | Callback ID |
callbackType | Callback type |
referenceId | Reference ID |
referenceType | Reference type |
caseDefinitionId | Case definition ID |
caseDefinitionKey | Case definition key |
caseDefinitionName | Case definition name |
caseDefinitionDescription | Case definition description |
caseDefinitionCategory | Case definition category |
caseDefinitionVersion | Case definition version |
caseDefinitionDeploymentId | Case definition deployment ID |
tenantId | Tenant ID |
permissions | Permissions for the current user |
translations | Translation values |
Multi-Instance Loop Variables
A BPMN multi-instance activity automatically sets the following variables.
| Variable | Description |
|---|---|
nrOfInstances | Total number of instances in the loop, set on the multi-instance root execution |
nrOfActiveInstances | Number of currently active instances, set on the multi-instance root execution |
nrOfCompletedInstances | Number of completed instances, set on the multi-instance root execution |
loopCounter | Index of the current iteration, set as a local variable on each child execution |
The default loopCounter name can be overridden per activity via the elementIndexVariable attribute on the multi-instance loop characteristics.
Reserved Internal Prefixes
Flowable reserves variable names starting with __flowable or __flw for engine-internal use, and may add further internal names under these prefixes in future releases without notice.
