Skip to main content
Version: 2.4

JEXL Evaluation And Context

Evaluation Model

A JEXL expression:

  • is usually a single expression, not a block of statements,
  • always returns a value,
  • can use variables from the current context,
  • can call built-in helper functions,
  • can create object and array literals,
  • can use the ternary operator instead of an if block,
  • can call Public API functions in the form service.entity.method(...).

Example for Hidden:

$context.form.customerSegment == 'B2B'

The result is true or false. In the Hidden property, true means that the widget is hidden.

Example for a computed value:

sumMany($context.form.items, 'price', 2)

The result is a number, for example 123.45.

Example for a data source:

crm.customer.find({ code: $context.form.customerCode })

The result is a customer object or another value according to the contract of the called API.

Context

The most common variables are:

VariableMeaning
$buildBuild metadata, for example build date/time.
$configApplication/API configuration available to the runtime.
$configUiUI configuration environment data.
$contextCurrent runtime context of the form or page.
$context.formCurrent form values.
$context.entityMain entity of the current detail page or screen.
$outputContextOutput context used by some composed or nested runtime flows.
$rowCurrent row index in table/grid-like contexts.
$runtimeInfoRuntime metadata, for example runtime id and related user/session information.
$valueCurrent field value, object, or item depending on where the expression is evaluated.
$versionCurrent application/runtime version string.
$context.form.<field>Direct access to a form field value.
$context.entity.<field>Direct access to a property of the current entity.
.charsDynamic characteristics of an entity or form, if available in the current context.

Examples:

$context.form.customer.name
$context.entity.id
$context.entity.chars.installationAddress

When accessing nested structures, remember that some intermediate object can be null or undefined. Use fallbacks:

$context.form.customer?.name ?? 'No customer'

If optional chaining is not supported in the specific JEXL field, use an explicit check:

$context.form.customer ? $context.form.customer.name : 'No customer'