Develop > Expression Language > Expression Language examples by output type

Expression Language examples by output type

The following examples demonstrate how to construct phrases in Expression Language for different purposes:

Expressions that return a string value

You can construct expressions that return a string value using text functions. For example, the expression ${concat('Error ','message')} returns Error message.

You can construct expressions that return a string value using records and properties. For example, the expression ${entity.Type} returns the type of the current record and ${entity.PhaseId} returns the current phase of the current record.

A property with a value of type Enum is a string value. For example, if the Urgency field is defined as an Enum type field, the expression ${entity.Urgency} returns the value of the Urgency field of the current record as a string.

Note The DisplayLabel property of an Enum value type field returns the localized label based on the current user locale. For example, the expression ${entity.Urgency.DisplayLabel} returns the value of the Urgency field of the current record in the language of the current user locale.

You can construct expressions using the arithmetical operations:

  • Example 1: ${(13 + 12)/5)} returns 5

The current record may have numeric or date value properties. For example, if there is a property CreateTime that denotes the time the record was created, you can construct an expression ${entity.CreateTime} to return that date value.

Expressions that return a boolean value

The simplest expressions that return boolean values are ${true} and ${false}.

Mathematical expressions using the equals ,not equals, greater than, or less than operators return a boolean value. For example, ${(5+7) > 10} returns true.

You can construct expressions that return boolean values using the match_pattern text function. For example, the expression ${match_pattern('Hello', 'H*o')} returns true. The expression ${match_pattern('Hello', 'H?o')} returns false, because the ? operator indicates a single character, and the * operator indicates multiple characters.

You can construct expressions using entities and properties that return boolean values:

  • Example 1: The expression ${entity.ApprovalStatus == 'Approved'} returns true if the ApprovalStatus property of the entity has the value Approved; otherwise, it returns false.

  • Example 2: The expression ${entity.PhaseId != 'Log'} returns false if the process is currently in the Log phase; otherwise it returns true.

For objects of type person, you can construct expressions using the IsPermitted property, which returns a boolean value. For example, the expression ${current_user.IsPermitted('EMS-View-Template(entityType = Request)')} returns true if the current user has permission to view records of type request; otherwise it returns false.

Similarly, you can construct expressions using the Person functions that return a boolean value. For example:

  • The expression ${is_manager_of(entity.Owner.Id,current_user.Id,2)} returns true if the person who is the owner of the current record is the manager of the person who is the current user; otherwise it returns false.
  • The expression ${entity.ownedByPerson.is_permitted_to_domain('Database')} returns true if the owner of the current record has permission for the Database data domain; otherwise it returns false.

Expressions that return a record value

The simplest expressions that return record values are ${entity}, which returns the current record itself and ${current_user}, which returns person who is the current user.

You can construct expressions using object properties that return record values:

  • Example 1: The expression ${entity.Owner} returns the person who is the owner of the current record.

  • Example 2: The expression ${entity.AffectsActualService.Owner} returns the person who is the owner of the ActualService affected by the current record.

Expressions that return a collection

You can construct expressions that return a collection of record values:

  • Example 1: The expression ${entity.PersonToGroup.Name} returns the collection of people related to the current record by the PersonToGroup relationship.

  • Example 2: The expression ${entity.AllStakeholders} returns the collection of all people who are stakeholders of the current record.

Note When entering an Expression Language phrase in a field that is not a plain-text field, the output may be displayed incorrectly. For example, it may contain HTML markup tags.

Related Topics Link IconRelated Information