Using CEL Expressions
CEL expressions write conditions and compute values. A Workflow connection, Journey path, Event Rule condition, Action, ability, Form, or metric can supply different variables, functions, and return types. Use the Developer CEL reference for the complete context, variable, operator, and function catalogs. This guide shows where expressions fit into common product tasks.
Workflow connections
Add a connection condition
- Open a Workflow and add the next Task.
- Select the connection between the Tasks and add a condition.
- Under Take this path, select Right away if the Workflow should move forward without a manual action. Agent chooses is the default.
- Test a matching and nonmatching path before publishing.
For the full Workflow setup, see Create a Workflow.
For example, this condition matches Members with the consented label:
"consented" in member.labels
The condition controls this connection. If it does not match, the Member stays on the current Task. A matching connection can still be blocked by an entry condition on the target Task, so test both sides of the path.
Use the right record scope
Workflow conditions can inspect records attached to the current Assignment or
the Member's longer-term history. Use assignment.collections for records
created during this Assignment, and member.collections for records across
the Member's Assignments.
For example, check whether the current Assignment has a call log:
assignment.collections.call_log.count > 0
Check whether a Member has ever had a call log:
member.collections.call_log.count > 0
The paths have the same shape but answer different questions. The Developer CEL reference lists the available paths and types for each authoring context.
Workspace
Singular workspace Forms use workspace.form_data.<form_slug>.<field>.
Collection Forms use workspace.collections.<form_slug>.latest.data.<field>;
.count returns their record count and .recent provides up to 50 records,
newest first. These values belong to the workspace rather than a Member.
Fields with no record yet return their schema type defaults. Records created
by a workflow test run count only when the expression or template is evaluated
for a test run. See
Creating Forms for setup.
In prompt templates, read a singular workspace Form with
{{ workspace.form_data.clinic_information.clinic_name }}. Collection Forms use
{{ workspace.collections.clinic_information.latest.data.clinic_name }}. Both
paths follow the acting Member's Form and field permissions.
Flat workspace.<form_slug>.<field> CEL paths are no longer supported. Update
existing collection expressions to workspace.collections.<form_slug>.latest.data.<field>.
Choose the expression context
- A Workflow connection condition controls a path between Tasks.
- An Event Rule condition controls whether an event-triggered Action runs. See Automating Actions.
- An ability condition controls when an ability is available. See Abilities.
- A Journey condition controls progression or a goal. See Creating a Journey.
- Form validation and computed formulas use their own CEL contexts. See Creating Forms and Computed Fields.
- Metric and qualification criteria evaluate completed runs. See Using Metrics and Qualifications.
Use the Developer CEL reference when an expression uses a variable, function, or operator not shown here.