Toggle menu

Process Variable Tokens and Expressions

UEL Expressions in Workflows

UEL expression have the format ${expression} and are handled by the workflow engine. They can be used:

  • in flow conditions
  • when calculating task assignees and candidates
  • to access variable values in activities like Mail, API Server and End Point
  • in the properties of timer tasks (note that the properties of timers are calculated and set when the execution arrives at the timer)

They can also be used in task descriptions, although we generally advise using process variable tokens (see below).

UEL expressions support simple conditions and function calls, and can be used to perform variable substitutions where they are supported.

For example, you could use this expression in the body of an email:

Hello ${male ? 'Mr.' : 'Mrs.' } ${recipientName}

In most cases the UEL expression must occupy the entire field. For example, an assignee can be set to ${initiator} but not to ${username}_internal

When the workflow execution arrives at a UEL expression, its value is calculated and used. For example, if you use a UEL expression in the description of a user task, when the user task is generated, the expression is resolved and the value added to the user task. The description will then be set and cannot be changed.

Process Variable Tokens

Process variable tokens are something we have designed. They can be used in:

  • task descriptions
  • process descriptions
  • history subject and event data
  • email body and subject fields

They have the same format as the tokens used in the forms designer:

Hello #form_FIRSTNAME#

Unlike UEL expressions, the value of a token is fetched each time it is needed, so can be updated.

For example, if you use a token in a user task description, each time the Self Service template displays that task, the current value of the token will be requested and displayed - unlike UEL expressions which are resolved once and set when the task is first created.

Tokens can also contain UEL expressions, like this: #${expression}#

Using Variables in Handlebars Templates

Areas of the process modeller that use HTML templates, like the body text of the email generated by the Mail task, can include Handlebars templates.

This example combines the standard notation for accessing variables with a Handlebars template.

The text generated will either read "Hi Tim" or "Hi Tim Gulliver" depending on whether or not the "Last name" box is filled out in the form (ie whether the form_LASTNAME variable is present).

<p>Hi ${form_FIRSTNAME}
    {{#if form_LASTNAME}}
        ${form_LASTNAME}
    {{/if}}
</p>

There's more information about using handlebars in the Handlebars Examples section.

Displaying Values in Forms

When a form is submitted that either starts a workflow or completes as task, the values of the fields of that form are stored as process variables. These variables are named form_FIELDNAME (where FIELDNAME is the name of the field in the forms designer).

If subsequent forms that interact with the process have names that match those of preceding form fields, the value of the appropriate form_FIELDNAME variable will be displayed in it.

There's an example of this in the Getting Started with Workflow article.

Last modified on January 02, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon