Develop > Expression Language > Object property expressions

How to form object property expressions

When you form an object property expression you refer to the current record by the term entity. The phrase ${entity} returns the current record itself. The phrase ${entity.Id} returns the Id property of the current record. The same Expression Language phrase can be used in business rules in a workflow, in tasks, or in notifications. In each instance, the term entity refers to the current record (for example, the current change in Change Management or the current request in Service Request Management).

The following special object instances are available:

Object Description Examples
current_user Returns the person who is currently logged in.
  • ${current_user.Name} returns the name of the current user (as a string).
  • ${current_user.is_permitted_to_domains('domain name', 'domain name'...)} returns a boolean value indicating whether the current user has permission for any of the specified data domains (true if he has permission for at least one of the domains; false if he has permission for none of them).
current_recipient Returns the person defined as the current recipient of the notification.  
current_task Returns the current task. Available for tasks only.
  • ${current_task.Urgency}. This expression demonstrates how to get the Urgency field for the current task.

  • ${current_task.Assignee.Upn}. This expression demonstrates how to get the ID of the set of people identified by the relationship Assignee (a one-to-many relationship) for the current task.

current_association_update For a many-to-many relationship, returns the current relationship. It can be used in business rules defined in process events connected with relationships (Before adding relationship, After adding relationship, Before removing relationship, After removing relationship).
  • current_association_update.association_name. Returns the current relationship name.

  • current_association_update.association_end1. Returns the record at the first end of the relationship. The phrase ${current_association_update.association_end1.Id} returns the Id of the record at the first end of the relationship.

  • current_association_update.association_end2. Returns the record at the second end of the relationship. The phrase ${current_association_update.association_end2.Id} returns the Id of the record at the second end of the relationship.

Current update

There is a unique object called current_update, which is only relevant for workflows. It is used to access fields of an object when there is a data update. The current_update object can be used with the following syntax:

  • field_name.IsChanged. The phrase ${current_update.PhaseId.IsChanged} returns a boolean value indicating whether the PhaseId field of the current record changed in the last data update.

    You can include an optional boolean parameter to ignore changes in the field value caused by the workflow and return the boolean value based on changes made by the user only. The phrase ${current_update.PhaseId.IsChanged('false')} returns true only if the PhaseId field of the current record was changed by the user in the last data update.

  • field_name.OldValue. The phrase ${current_update.PhaseId.OldValue} returns the previous value of the PhaseId field of the current record before the last data update.
  • field_name.NewValue. The phrase ${current_update.PhaseId.NewValue} returns the new value of the PhaseId field of the current record after the last data update.

  • You can use the current_update to check if the time stored in a field has passed. The phrase ${current_update.SolutionTargetTime.NewValue >= now()} returns a boolean value (true if the time stored in the SolutionTargetTime field is greater than or equal to the current time; false otherwise).

Another use of the current_update object is to determine the scope of the updates. The phrase ${current_update.IsOnlyPermittedChanges} returns true if all changes were made to the following fields only:

  • Id
  • LastUpdateTime
  • Comments

Summary of object expressions

The following table indicates where in the system the different Expression Language object property expressions are valid:

Data source expression Valid in:
entity Workflows, tasks, and notifications
current_user Workflows and tasks
current_task Tasks only
current_recipient Notifications only
current_update

Workflows only. All process events, except:

  • Before removing relationship
  • Before adding relationship
  • After adding relationship
  • After removing relationship
  • Per Schedule
  • SLT event
current_association_update

Workflows only. The following process events only:

  • Before removing relationship
  • Before adding relationship
  • After adding relationship
  • After removing relationship

Complex type fields

Some records have complex type fields, which means that the field has fields of its own that you can access using the property name. For example, in Service Asset and Configuration Management there is a complex field named Cpus of subtype Cpu. The Cpu subtype (which is a complex type) has fields of its own, such as CpuId and CpuType. To access these fields, enter the following expression language phrases ${entity.Cpus.CpuId} and ${entity.Cpus.CpuType}.

In addition, some complex type fields are declared as dynamic. Dynamic complex type fields may contain different subtypes. For example, in Change Management, there is a dynamic complex field named UserOptions. If such a field contained a subfield named HostName, then to access it, enter the following Expression Language phrase: ${entity.UserOptions.HostName}.

Related Topics Link IconRelated Information