This documentation supports the 20.08 version of BMC Helix Platform. 
To view an earlier version, select 20.02 from the Product version menu.

Types of expressions in expression editor

This topic provides information about expressions that you can build by using the Expression Editor.

Terminology

JavaBean Expression

The expression we introduced in BMC Helix Platform is called JavaBean expression. The syntax is based on UEL (Unified Expression Language), and used in JSP 2.0 (Java Server Page). The word "JavaBean" comes from JSP where it uses the expression to access JavaBeans. The dots in the expression is to navigate to properties of the bean. Notation "${}" is used to dereference the expression to a value.  

Assignment

Assignment is about assigning some value to a target. It has an assignment target and a value expression. Both can be JavaBean expressions. The value expression can have arithmetic operations (+, -, *, /, %), with each value expression surrounded by dereference notation "${}",

Important

The BMC Helix Platform server converts the arithmetic operation into the type of target field.

If the type of the target field is integer, then while performing an arithmetic operation, introduce an integer variable to capture the result of this arithmetic operation, and then assign it to the required selection field.

Condition

The expression for the condition has to be evaluated to a boolean value- true or false. Condition expression can have arithmetic operations (+, -, *, /, %) on value expressions; relational operations (>, <, =, !=, >=, <=) on value expressions; and logical operations (AND, OR, NOT) on relational operations.

BMC Helix Platform JavaBean Expression Syntax

Context Indicator

In the value expression, the first part of the expression is the context indicator. Here are context indicators we support today, and how they are used:

processContext

The value is from a process variable, which can be process input, output or local variable. If the variable is a non-primitive, i.e. record instance or a java object, you can use "." to navigate to fields/properties of the non-primitive object.

SyntaxExampleNotes
${processContext.<variable name or id>...}${processContext.Ticket ID}"Ticket ID" is the name of the process variable
 ${processContext.Task.4}"Task" is a process variable. it is a Record Instance type. This expression resolves to Task variable's Assignee field (field id 4).  

To use a dynamic variable in a string, you can simply type the $variable name in the string and the value of the variable is inserted in the string at runtime.

For example:

“Hi $user, your ticket is created. The id is $ticketId. You can view the ticket details at $ticketLink.”

When you use any field, variable, or keyword within a string expression, it will be evaluated to the value at runtime. If you want to use the variable name and not its value in the expression, then add an escape character (\) to the expression.

For example, "$\{processContext.processVariableName}".

activityResults

The value is from the result of a process activity.

SyntaxExampleNotes
 ${activityResults.<activity definition GUID>.output...>${activityResults.<GUID>.output}The expression evaluates to the Service Task output.
 ${activityResults.<GUID>.output.timeToResolve}

The activity in this example is Service Task "Service Level Calculation".

The expression evaluates to the calculation result. The result is a compound java object, so we can use "." to refer to its properties.

 ${activityResults.<GUID>.output[0].8}

The activity in this example is Service Task "Get Records By Query", so the output is a list of record instances.

This expression resolves to the first record instance's Description field (field id 8).  

${activityResults.<activity definition GUID>.<process output variable name or id>...>${activityResults.<GUID>.Approval Status} = \"Approved\"The activity in this example is Approval Process, which has "Approval Status" as the process output. This condition expression checks if the approval status is "Approved" or not.

userTask

This context is only applicable to Process UserTask completion condition. It resolves to the UserTask record instance. 

SyntaxExampleNotes
${userTask.<userTask field name or Id>}${userTask.Status} = \"Reviewed\""

This expression checks if the status of user task record instance is changed to "Reviewed".

If the condition is true, the User Task is completed, and the process instance resumes.

ruleContext

the value is from the record instance that triggers the rule.

SyntaxExampleNotes
${ruleContext.<field name or Id>}${ruleContext.Status} = \"New\"This expression checks the Status field of the record instance that triggers the rule

actionResult

the value is from the result of the current rule action.

SyntaxExampleNotes
${actionResult.output.<property name>}${actionResult.output.timeToReview}

This expression resolves to the rule action output.

The output is a compound java object, so we can use "." to refer to its properties.

${actionResult.<process output variable name or id>...}${actionResult.Approval Status}The action in this example is Start "Approval Process". The process has "Approval Status" as the process output.

recordContext

the value is from the record instance that the grid is operating on.

SyntaxExampleNotes
${recordContext._associations.<association definition GUID>.<node side>[index].<field id>}${recordContext._associations.<association definition GUID>.nodeB.[0].8}The expression refers to the record instance in the record grid

view

The value is from a view component

SyntaxExampleNotes
${view.components.<view component GUID>..}${view.components.<GUID>.379}This expression resolves to the ID field of the first selected row of a record grid.

Items in a collection

List

we use "[]" notation with numerical index. For example, output[0]

Map

we use "[]" notation with the map key being a string. For example, values["Short Description"]

Associated record instances

From JavaBean point of view, when two record instances are associated, the associated record instance can be interpreted as the property of the first record instance. For example, when Employee record is associated with Department record, we can also interpret Department being a property of Employee. Therefore, using JavaBean expression, we can naturally navigate from one record instance to associated record instances.

SyntaxExampleNotes
${<record>._associations.<association definition GUID>.<nodeSide>} ${processContext.Task._associations.<association definition GUID>.nodeA[0].10001995})

Task and Customer are associated.

This expression navigates from Task record instance to the associated Customer record instance.

 ${activityResults.<activity definition GUID>.output._associations.<association definition GUID>.nodeA[0].10001995}The record here is from an activity result, and the activity is GetRecord. The association expression is the same as the above.
 ${recordContext._associations.<association definition GUID>.nodeB.[0].8}The record here is from a record grid. The expression is able to bring fields of associated record into the grid.

Keywords

Keywords can be used in the expression. They are resolved to a value during the runtime. Keywords are available under the "General" subtree of the expression dictionary UI. Here are supported keywords in BMC Helix Platform, and the value each keyword is resolved to. Some of the keywords are only applicable to a particular definition.

When you use any keyword within a string expression, it will be evaluated to the value at runtime. If you want to use the variable name and not its value in the expression, then add an escape character (\) to the expression.

For example, "$\{processContext.processVariableName}".

Current Date

This keyword resolves to the current date, and the time defaults to midnight.

Current Date and Time

This keyword resolves to the current date and time.

Current Group IDs

This keyword resolves to the list of the group IDs of which the current user is a member. If there are no groups, the value is an empty string. If there are groups, the value is a string displayed in the following format:;<groupID>;<groupID>;<groupID>;

Current Groups

This keyword resolves to the list the group names of which the current user is a member. If there are no groups, the value is an empty string. If there are groups, the value is a string displayed in the following format: <groupName> <groupName> <groupName>

Current Operation

This keyword resolves to the current record operation. This keyword is only applicable to a rule definition.

Current Record

This keyword resolves to the current record rule is operating on. This keyword is only applicable to a rule definition.

Current Record Definition Name

This keyword resolves to the current record definition name. This keyword is only applicable to a rule definition.

Current Roles

This keyword resolves to names of the list of roles that map to groups to which the current user belongs. If there are no roles or no mapped groups, the value is an empty string. If there are mapped roles, the value is a string displayed in the following format: <roleName> <roleName> <roleName>

Current Server URL

This keyword resolves to the URL of the current server. It is in the format of http://<hostname>:<port> or https://<hostname>:<port>, depending on if SSL is configured or not. The host name here is the server external name, which is visible outside of the firewall.

Current Time

This keyword resolves to the current time.

Current User

This keyword resolves to the current logged in user.

Current User Locale

This keyword resolves to the language and country code for the current logged in user. It is in the format of <language>_<countryCode>

Current Week Day

This keyword resolves to the current day of the week

Process Correlation ID

This keyword resolves to the process correlation id. The correlation id can be used to uniquely identify a process instance execution. If the process is in a parallel execution through parallel gateway or parallel multi-instance loop, using this keyword in the parallel path, it generates separate correlation id to identify each execution path. This keyword is only applicable to a process definition.

Supported Data Type

  • Expression supports all Rx data types except Attachment. The supported data types are Integer, Floating, Decimal, Selection, Boolean, Date, Date/Time, Time, Text.  
  • Process expression and rule expression supports Record Instance, Custom Java Object (developer defined Java object).
  • Action supports Map and List as the Action input parameters, but with restrictions. The restrictions are the following:
    Map
    • Map key being a constant, but map value is an expression. the key value pairs are itemized explicitly:

      The JSON of the action definition input map 
      {
        "assignTarget": "values[\"Description\"]",
        "expression": "${processContext.name}"
      },
      {
        "assignTarget": "values[\"Submitter\"]",
        "expression": "$USER$"
      }
      
      FooServiceImpl.java:
      @Action()
      public RecordInstance createSomething(
               @ActionParameter(name = "values") Map<String, String> values) {
      ...
      }
    • An action that returns a map can be used as the map input of the next action.

    List

    • A comma separated string can be used as the input value for List<String> parameter.

    • An action that returns a list can be used as the list input of the next action.

Was this page helpful? Yes No Submitting... Thank you

Comments

  1. Amit Panchal

    How to write below if condition in Expression Editor under Views

    if(x>y || y>z) { status = "Current Status" }

    Dec 17, 2020 03:55