17.3. Using the Expression Editor
To make the task management system more dynamic expressions, you can select to use expressions instead of hard-coded values for some of fields in activitiy templates. The following activity template fields can be set using expressions:
-
Potential owners
-
Recipients, display name and description in a start or completion notification escalation
-
The “Reassign to” user/user group in a start or completion reassignment
escalation -
Value rule in for input data
The expressions can be viewed as rules for setting values so “Rule” is in this context a synonym for “Expression”. To make it easier to write valid expressions for these fields you can use the “Rule Editor”.
This chapter describes how to use the Rule Editor.

The expression language #
Expressions are strings written in a proprietary language. It’s an untyped language with some syntax similarities to Java, Javascript and Smalltalk. The language is object-oriented. There is an underlying type system which is hierarchal and the top type is “Object”. Types which extends other types are called “subtypes” and types which are extended are called “supertypes”.
The complete type tree can be browsed in the Rule Editor Helper Tree when starting from the “Type: Object” node under the “Functions” top level node and traverse down all “Subtypes” child nodes.

Functions in the language are defined on the types and are inherited by subtypes. Functions can be redefined on subtypes.
All types are visible as top-level nodes under the “Functions” node in the Rule Editor Helper Tree. To make it easier to locate functions all functions defined on the type and on all supertypes are visible on each type. The functions which are defined on a supertype has the name of the type in parenthesis after the function name.

In this example the type Task has a locally defined function called nextTask and an inherited function called activityDisplayName which is defined on the type
Activity.
Expression syntax #
An expression consists of one or more statements terminated with a semi-colon. All statements returns a value. The value of the last statement is the value of the whole expression. You may omit the terminator (";") for the last statement and before else and endif.
Variables are implicitly defined when referenced the first time. Some are pre-defined and read-only. The variables cannot have same name as a keyword or “true”, “false”, “null”. The keywords are { “if”, “else”, “then”, “endif”, “for”, “while”, “do”, “break”, “continue”, “return”}
Parenthesis may be left out on no-argument function invocations, so for example task.activityDisplayName is equivalent to task.activityDisplayName().
Parenthesis may be left out on one-argument function invocations where the argument is a block.
The assignment operator is “:=” and equality operator is “=”.
The Rule Editor Helper Tree is intended to be used as a tool to create valid expressions where you for example can find pre-defined variables, the valid statement types, how to write comments, true/false/null literals, assignments, valid operators etc.
Examples #
To give you a head start when writing expression the Rule Editor has some examples included which can be used as a starting point.
- Expand the “Examples” top level node in the Rule Editor Helper Tree
- Click on any of the example text node to see detail of the example
- Double-click on the example text node to copy the example code to the expression field

Sample: Create an expression which returns the process display name #
In the following we assume that the Rule Editor is started from “Input Data” were a new Value Rule is to be added by pressing the “Rule Editor” button.
-
Ensure the expression field (on the right side of the window) is empty
-
Expand the “Variables” node in the Rule Editor Helper Tree
-
Double-click on the “process” node
Result: The text “process” is copied to the expression field -
Expand the “Functions” node
-
Expand the “Type: Process” node under the “Functions” node
-
Expand the “Functions” node under the “Type: Process” node
-
Double-click on the “activityDisplayName (Activity)” node under the newly expanded “Functions” node
Result: The text “.activityDisplayName” is appended to the text “process” in the expression field

Sample: Create an expression which branch depending on process priority #
In the following we assume that the Rule Editor is started from “Potential Owners” were a new rule is to be added by choosing the menu item “Create Assignment Rule…”.
Let’s assume that the task’s potential owners should depend on the priority of the process. If the priority is greater than 5 the user OECKHOFF should do the task otherwise the user HSVERDRU should do it.
-
Ensure the expression field (on the right side of the window) is empty
-
Expand the “Statements” top level node in the Rule Editor Helper Tree
-
Double-click on the “if-then-else” node under the “Statement” node
Result: The expression contains the following text:
if <Expression> then <StatementList> else <StatementList> endif -
Remove the “<Expression>” part of the expression by marking and deleting it
-
Expand the “Variables” top level node and double-click on “process” node
-
Expand the “Functions” top level node
-
Expand the “Type: Process” node
-
Expand the “Functions” node under “Type: Process” node and double-click the “priority” node
Result: The expression contains the following text:
if process.priority then <StatementList> else <StatementList> endif -
Expand the “Operators” top level node
-
Double-click on the “> (greater than)” node
-
Manually add the text “5” to the expression
Result: The expression contains the following text:
if process.priority > 5 then <StatementList> else <StatementList> endif -
Remove the “<StatementList>” part of the expression by marking it and press delete
-
Expand the “Variables” top level node and double-click on the “system” node
-
Locate the “user” function under “Functions” under “Type: System” under the top level node “Functions” and double-click on it
Result: The expression contains the following text:
if process.priority > 5 then system.user(<userName>) else <StatementList> endif -
Remove the “<userName>” part of the expression by marking and deleting it
-
Manually add the text “‘OECKHOFF’” to the expression (NB! Note the ’ (single quote) before and after OECKHOFF)
Result: The expression contains the following text:
if process.priority > 5 then system.user(‘OECKHOFF’) else <StatementList> endif -
Repeat for “<StatementList>”
Result: The expression contains the following text:
if process.priority > 5 then system.user(‘OECKHOFF’) else system.user(‘HSVERDRU’) endif
Sample: Create an expression with more than one statment #
The expression may contain multiple statements, local variables and comments. The result of the expression is the value of the last statement.
In the paragraph Sample: Create an expression which branch depending on process priority above a single statement was created for returning a task’s potential owner depending on priority. Here we will create an alternative expression containing multiple statements, local variables and comments to show aspects of the language.
-
Ensure the expression field (on the right side of the window) is empty
-
Expand the “Statements” top level node and double-click on the “Assignment” node
-
Delete the “<Variable>” part of the expression and write “priority” instead
-
Delete the “<Expression>” part of the expression
-
Expand the “Variables” top level node and double-click on the “process” node
-
Locate the “priority (Activity)” function under “Functions” under “Type: Process” under the top level node “Functions” and double-click on it
Result: The expression contains the following text:
priority := process.priority; -
Place the cursor at the end of expression
-
Expand the “Literals and constants” top level node and double-click on the “comment” node
Result: The expression contains the following text:
priority := process.priority; “<comment>” -
Replace the <comment> with a relevant comment
for example “Use process priority instead of task priority” -
Press enter in the expression to create a new line
-
Create another variable assignment, for example by using the “Assignment” node as above
-
Delete the “<Variable>” part and write “potentialOwner” instead
-
Replace the “<Expression>” part with the following if-then-else statment
“if priority >5 then ‘OECKHOFF’else ‘HSVERDRU’ endif”
Result: The expression contains the following text:
priority := process.priority; “Use process priority instead of task priority”
potentialOwner := if priority >5 then ‘OECKHOFF’else ‘HSVERDRU’ endif; -
Press enter in the expression to create a new line
-
Add the statment “system.user(potentialOwner)”
Result: The expression contains the following text:
priority := process.priority; “Use process priority instead of task priority”
potentialOwner := if priority >5 then ‘OECKHOFF’else ‘HSVERDRU’ endif;
system.user(potentialOwner)
Mark that the result of the expression is the last statement (“system.user(potentialOwner)”). The last statement may have an ending semicolon to end the statement but it is not required.
Mark also that in contrast to Java the if-then-else statement returns a value (which in our case is assigned to the variable “potentialOwner”.
Search in the Rule Editor Helper Tree #
All text in the Rule Editor Helper Tree is searchable.
Assume you want to search for “priority”:
-
Write “priority” in the type filter text field
-
Press the “Filter” button
-
The Rule Editor Helper Tree will show only those nodes which contains the text “priority”
and the “Filter” button has changed name to “Clear”. -
You can restore the Rule Editor Helper Tree by pressing the “Clear” button

The node “template” under the top level node “Variables” is present because the example in the description contains the text " if template.priority> 1 then <do something> endif".
The nodes “Type: Activity” and “Type: Activity Template” are present because they both contain a function called priority.
Field description 3. Rule Editor
| Field | Description |
|---|---|
| Type filter text | Used to search for information in the Rule Editor Helper Tree Values: Text Default: Empty (indicated by the text “Type filter text”) Validations: None Mandatory: No Functional Impact: None |
| Filter | Functional Impact: Search in Rule Editor Helper Tree for the type filter text and remove nodes which doesn’t match the text . Will be renamed to “Clear” when tree is filtered |
| Clear | Functional Impact: Clear the filtering and restore the Rule Editor Helper Tree to it’s initial state |
| Rule Editor Helper Tree Description Expression |
Used as a help when writing expressions. Shows a description for each node in the Rule Editor Helper Tree The expression Values: Free text (but will be interpreted as an expression and must be syntactially correct when saved) Default: Empty/no text Mandatory: No |
Field description 4. Rule Editor Helper Tree
| Node | Description |
|---|---|
| Variables | Contains the predefined variables which are available when the expression is evaluated. Which variables are available depends on which context the expression is used (for example in potential owners or in input data) |
| Statements | Contains all expression statement templates which can be inserted into the expression. The list of statements is exhaustive, so the statements under this node are all that are available in the language |
| Operators | Contains operators which can be used in expressions. Operators are binary infix or unary prefix functions. The list of operators is exhaustive, so all availble operators are listed here. |
| Literals and constants | Contains literals and constants which can be used in expression. The list of literals is exhaustive, so all available literals are listed here. |
| Functions | Contains a list of all types in the language and for each type the valid functions (and their parameters), subtypes and supertypes. |
| Examples | A list of expression examples with a description of what they do and example code which can be included in the expression |