Using CEL Expressions
CEL expressions write conditions and compute values. A Workflow connection, Journey path, Event Rule condition, Action, ability, Data Type, 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.
Build a condition without writing CEL
Every condition field opens in the Builder. You do not need to type CEL to write a condition:
- Select Add condition. Choose a field from the list. Fields show by name; type part of a name, or its path, to search.
- Choose an operator. The list fits the field. Text fields offer, among others, equals, contains, starts with, is any of and is empty; number fields offer comparisons; date fields offer, among others, is before, is after, is within the last … days and is more than … days ago.
- Enter the value. A field with set options shows them as a list.
- To combine conditions, add more rows and set Match to All of or Any of. Add group nests a group with the opposite match, for "this, and one of those".
The Builder saves the same CEL you could type. For example, a Member Field
Stalled Branch · contains · 4 saves as
contains(member.fields["Stalled_Branch"], "4"). The expression it saves is in
Advanced.
A row that has no field, or no value, is outlined, and your changes are not saved until you finish or remove it. To match an empty text field, use is empty: a cleared value box counts as no value. When the row is complete, the condition saves again.
The Builder names each field by its label and does not show the expression. A saved field the list no longer has shows its path instead. Select Advanced to see or type the expression itself. A condition the Builder cannot show as rows — for example one that compares two fields — opens in Advanced with a note; you can still edit it there. The AI assist button beside the toggle writes a condition from a plain-language description in either mode.
Workflow connections
Add a connection condition
- Open a Workflow and add the next Task.
- Select the Path between the Tasks. Under Available, select When a condition matches and build the condition (see Build a condition without writing CEL), or select Advanced and type the expression.
- Under Choose, select Automatically when available to advance
when the condition is true. Agent decides is the default; the condition
permits the Path, and Choose when guides the Agent’s choice. For automatic
Paths, Selection priority sets the order; the first matching Path wins.
An automatic Path is checked when the Member arrives at the Task, before the
Agent speaks, and again after each Agent reply. If its condition is already
true on arrival (for example, it reads Member data), the Member moves on
and the Agent speaks once, from the next Task. A condition that reads
tool_invocationswaits for the Agent's turn, because no tool has run yet. When such a Path moves the Member after the Agent has already replied, the next Task speaks on the Member's next message, so one message never gets two replies. - 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
Workspace Fields use workspace.form_data.<form_slug>.<field>.
Workspace Tables 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
Data Types for setup.
In prompt templates, read a Workspace Field with
{{ workspace.form_data.clinic_information.clinic_name }}. Workspace Tables use
{{ workspace.collections.clinic_information.latest.data.clinic_name }}. Both
paths follow the acting Member's Data Type and field permissions. Prompt templates
can also name a Workspace Field by its ID:
{{ workspace.fields.<form handle>.<field key> }}. Insert Variable adds this
form from the Workspace Fields group. CEL does not read workspace.fields.
Flat workspace.<form_slug>.<field> CEL paths are no longer supported. Update
existing collection expressions to workspace.collections.<form_slug>.latest.data.<field>.
Member relationships
member.relationships lists the Member's active
relationships. Each entry has a kind — the
role the other member plays — and that member's related_member_id:
member.relationships.exists(r, r.kind == 'primary_contact')
primary_contact matches a Member who has a primary contact;
primary_contact_for matches a Member who is someone's primary contact.
size(member.relationships) > 0 matches any relationship. Removed
relationships are not listed. Templates cannot read member.relationships.
Linked connections
member.linked says whether the Member is linked to a record through a
connection of each type. Each value is true or false:
member.linked.salesforce
The types are fhir, healthie, hubspot, monday and salesforce. A
Member is linked when the connection knows which remote record is this Member.
The link does not depend on the connection's Data Type records: a linked Member
may have no profile record, and a profile record does not make a Member linked.
member.linked.monday is true when the Member is linked on any board. A
record the connection is still creating does not count until it exists.
Use member.linked.<type> in place of has(member.fields["salesforce:id"]) and
the other Connection ID keys. Do not wrap it in has(): every type is always
present, so has(member.linked.salesforce) is always true. A misspelled type
is rejected when you save. Templates cannot read member.linked.
Related Members
member.related reads the related Members themselves, for three roles:
| Path | What it holds |
|---|---|
member.related.contact_owner | The Member who owns this contact in a connected CRM. One Member, or none. |
member.related.primary_contact | This Member's primary contact. One Member, or none. |
member.related.doctor | This Member's doctors. A list, which can be empty. |
Each related Member has id, name, first_name, last_name, email,
phone and fields. fields works like member.fields, with the same
bracket spelling:
has(member.related.contact_owner) &&
member.related.contact_owner.fields["Scheduling link"] != ""
member.related.doctor.exists(d, d.last_name == "Rivera")
Use has() before you read a role that holds one Member: when there is no
contact owner, member.related.contact_owner is not set. Removed
relationships and archived Members are not included.
Other roles, such as spouse or patient, cannot be read. An expression
that names one is rejected when you save it. Inside a list macro over
doctor, you can read the scalar keys but not fields:
member.related.doctor.exists(d, d.fields["…"] == "…") is rejected when you
save it.
member.related works in the conditions of Workflows, Journeys, Actions and
abilities.
Computed fields, field validation rules, sync filters, qualification criteria
and metric criteria cannot read it. A condition reads member.related without the
Members: read permission: it decides true or false and shows no value to
a Member.
Prompt and message templates read the same paths:
Your coordinator: {{ member.related.contact_owner.first_name }}
{% if member.related.contact_owner %}Book a time: {{ member.related.contact_owner.fields["Scheduling link"] }}{% endif %}
{% for d in member.related.doctor %}{{ d.name }}{% if not loop.last %}, {% endif %}{% endfor %}
A one-per-Member role with no Member (contact_owner, primary_contact)
renders as empty text. A list role with no Members (doctor) prints [] when
you output it directly, so loop over it with {% for %} as above instead.
A message sent to a Member renders that Member's own related Members, with no
Members: read permission needed. This is the one exception: in every
other template, reading member.related needs Members: read, the same as
reading another Member's member.fields (see Member fields).
Without it, each role renders empty: a one-per-Member role as empty text and
doctor as [].
In a message sent to a Member, member.related.<role>.fields shows only the
fields that Member may read on the related Member's record. A field marked
admin-only, or a synced field on a Data Type or record the Member cannot read,
renders empty. Custom
Member Fields, such as a scheduling link, still show.
Member appointments
member.appointments holds the calendar events the Member attends, including
events imported from Healthie or HubSpot:
| Path | Value |
|---|---|
member.appointments.next | The earliest upcoming appointment that is not cancelled or a no-show |
member.appointments.last | The latest appointment that already started and was not cancelled |
member.appointments.last_missed | The no-show with the latest start |
member.appointments.last_cancelled | The cancelled appointment with the latest start, which can be in the future |
member.appointments.upcoming | Up to ten upcoming appointments that are not cancelled or no-shows, soonest first |
member.appointments.recent | Up to ten appointments that already started, any status, most recent first |
Each appointment has start and end (timestamps), status (TENTATIVE,
CONFIRMED, CANCELLED, NO_SHOW or COMPLETED), type_id and type_name
(the appointment type), calendar_id, and source (internal, healthie,
hubspot, ...). If you have calendars:read, the condition builder lists
your appointment types by name for type_id on the four single
appointments; otherwise it shows the numeric id.
A no-show still counts as last. To ask whether the Member attended, check
member.appointments.last.status != 'NO_SHOW'.
Event rules, task edges, and journey conditions and endings can read
member.appointments. Qualification and metric conditions cannot.
The four single appointments are null when the Member has none, so check
first:
member.appointments.next != null
&& member.appointments.next.start < now + duration('24h')
size(member.appointments.recent.filter(a, a.status == 'NO_SHOW')) >= 2
Templates read the same values. Times render as UTC ISO-8601 text, for example
{{ member.appointments.next.start }}. A template shows another Member's
appointments only to a reader with calendars:read; the Member always sees
their own. For a reader without access, a template sees the same values as
for a Member with no appointments.
Notification preferences
member.notify_sms, member.notify_email, member.notify_voice, and
member.notify_whatsapp are the Member's workspace-local notification
preferences. They are not brand-wide consent: a STOP to one practice's number
turns off that workspace's SMS preference and records a brand-scoped opt-out,
while Account.opted_out is left alone. Use the flags like any other Member
value:
!member.notify_sms
On member:updated, changes reports the transition an inbound STOP or START
made, so a rule can match the message that turned SMS off instead of every later
update to the same Member:
"notify_sms" in changes && changes.notify_sms.new == false && !member.notify_sms
changes.notify_sms.old holds the previous value. The other three flags are
advertised in changes the same way.
The member.notify_* flags are workspace-local, not Account.opted_out and
not proof of consent — enforcement still uses the brand-scoped suppression
ledger.
Form record changes
On data_record:updated, changes.<field>.old and changes.<field>.new hold
a Form field's previous and new value, where <field> is the field's slug as
listed under Variables in the expression editor. A record-update condition
can use them to match only the field that changed:
has(changes.status) && changes.status.new == "Qualified"
changes is bound on data_record:updated, and on data_record:changed only
when the record was updated. data_record:changed also fires when a record is
created, and on that fire only record.* is present. On data_record:changed,
guard the read with record.operation:
record.operation == "updated" && has(changes.status) && changes.status.new == "Qualified"
Member fields
A Member's Fields come from three kinds of source: Fields you add, the
Synced fields a connection writes to its Data Type, and Connection IDs such
as salesforce:id. member.fields is being retired: the CEL editor's
Variables menu and the Builder no longer list its keys. Read a value from the Data
Type that holds it instead (member.form_data.<data_type>.<field>, below). An
existing expression reads a key in bracket form:
member.fields["salesforce:MailingCity"] == "Springfield"
member.fields["<key>"] reads one value: the highest-precedence source that
has one. The source shown beside a field is where its values come from, not a
restriction — the expression stays the same when you add another connection.
A Member filter on the same field matches a Member when any source
matches.
To read one connection's value, address that connection's Data Type with the field's saved slug. A field created since readable slugs has a reference like this:
member.form_data.salesforce_member_profile.mailing_city != ""
An older field keeps the hashed slug it was saved with, so its reference looks like this:
member.form_data.salesforce_member_profile.mf_mailing_city_1a2b3c4d5e6f != ""
Renaming a Synced field changes only its display name; keys, slugs and saved expressions keep working.
Prompt and message templates read the same values with the same bracket
spelling. Keys contain :, so dotted access such as member.fields.salesforce:id
does not work:
Your device: {{ member.fields["salesforce:VMS_Hardware__c"] }}
{% if member.fields["salesforce:id"] %}Linked to Salesforce{% endif %}
A key the Member has no value for renders as empty text. A template reads the
fields of the Member it is about. A message sent to a Member renders their own
fields, except Synced values member.form_data hides from them: a field on a
Data Type they cannot read, or a field marked admin-only. Reading another Member's fields needs the
Members: read permission.
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.
- Field validation and computed formulas use their own CEL contexts. See Data Types 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.