Develop > Expression Language

Expression Language

The Expression Language is a language that enables you to construct meaningful expressions that can be entered in different parts of the user interface.

The expressions can be of the following types:

  • A logical expression

  • A mathematical expression

  • An object property

  • A function call

You can define complex expressions made up of combinations of these types of expressions.

Note Expressions must be enclosed within brackets {} and preceded by a $. For example:

${entity.Owner.Id}

If you enter an expression that is not formulated properly, an error is generated.

Expression Language examples

The following examples provide a brief preview of the scope of the Expression Language:

  • ${entity.Name} returns the name of the current record.
  • ${entity.Name == 'user1'} returns true if the name of the current record is user1; otherwise it returns false.
  • ${entity.Owner.Name} returns the name of the owner of the current record.
  • ${concat(entity.Name, entity.Owner.Name)} returns the name of the current record followed by the name of the owner of the current record. (This example demonstrates the use of the concat function.)

For detailed information on the Expression Language and complete tables of functions and properties, see Expression Language functions and syntax.

Value types returned by expressions

The expressions return a value of a specific type. The following value types are supported:

Type Example of value type
Null null
Boolean true, false
String 'hello'
Double 0.5
Integer 4
Long 545555555L
Collection ('Sunday', 'Monday', 'Tuesday')
Record Record of type Change, record of type Incident
Person Record of type Person

Note When constructing an expression, make sure that the value type returned by the expression matches the required value type for the context in which you are working.

Null values and collections in Expression Language

The following rules govern the handling of collections and null values in Expression Language:

  • A null value is equivalent to an empty collection. Example: ${null == ()} returns true.

  • A collection of size 1 is equivalent to a scalar object. Example: ${5 == (5)} returns true.

  • A null value and an empty collection are not contained in a non-empty collection. The contain function returns false in such a case. Example ${contain((1, 2), null)} returns false.

  • The is_empty_collection function returns true for a null argument and false for a collection of size 1 (with a non-null value). Example: ${is_empty_collection(null)} returns true. ${is_empty_collection((4))} returns false.

  • A string with a numeric value is treated as a numeric value. Example: ${3 == '3'} returns true.

  • A string with a boolean value is treated as a boolean value. Example: ${false == 'false'} returns true.

  • Two collections of the same objects in different order are equivalent. Example: ${(2, 4, 6) == (4, 6, 2)} returns true.

  • A null value is ignored in a collection. Example: ${(2, null) == (2)} returns true.

  • A null value is treated as a double value type with a value of negative infinity. A null value is always less than a non-null value.

    Examples:

    • ${null > 5} returns false
    • ${null < 5} returns true
    • ${null < null} returns false

Related topics