Skip to main content

Template Filters

Gravity Rail templates are rendered with Jinja2, so every standard Jinja2 filter is available — upper, lower, title, capitalize, trim, default, length, join, replace, truncate, int, float, round, sum, min, max, urlencode, and more. Use them with the pipe (|) syntax: {{ value | filter }}.

On top of those, Gravity Rail adds a few custom filters tailored for member data.

oxford_join — format a list with Oxford commas​

Turns a list of values into a grammatically natural English phrase.

InputOutput
['apple']apple
['apple', 'pear']apple and pear
['apple', 'pear', 'plum']apple, pear, and plum
Today we discussed {{ member.data.visit.topics | oxford_join }}.

date — format dates and timestamps​

Reformats a date, time, or datetime value. Default output is YYYY-MM-DD; pass any strftime format string to customize.

{{ record.created_at | date }}                    → 2026-04-15
{{ record.created_at | date('%d/%m/%Y') }} → 15/04/2026
{{ record.created_at | date('%B %d, %Y') }} → April 15, 2026
{{ member.date_of_birth | date('%b %d') }} → Apr 15

If the input can't be parsed as a date, the original value is returned unchanged. Empty or missing values render as "".

Wrap the destination's public Site URL to give the message recipient a one-time automatic login, with ordinary Site login as the fallback:

Hi {{member.first_name}} — please review your options at
{{ "https://care--example.gravityrailsites.com/en-US/intake" | site_autologin_link }}

Use the URL shown in the workspace's Sites list: a source Site under *.gravityrailsites.com, a themed Site under *.sites.gravityrail.com, or a verified mapped domain. The destination must resolve to a Site in the sending workspace. Use an absolute URL; a relative path does not identify the Site.

How it works:

  • Outbound SMS/WhatsApp action message bodies, email action subjects and bodies, and the Send SMS tool can mint a fresh credential for the actual recipient. The recipient must be an active Member linked to an Account, and the delivery address must match that Account's email or phone for the channel used.
  • The credential expires after 15 minutes and can be redeemed once. It signs the recipient into that Site's origin and workspace using their existing permissions. It does not create an Account, grant a role, or select a Form or Workflow.
  • Expired or already-used credentials, accounts requiring MFA, and recipients who cannot receive an automatic login use the ordinary Site login screen. After login, they return to the requested page.
  • Preview renders and rendering contexts without a verified delivery recipient produce an ordinary login link, without issuing a credential. This includes initialUserMessage Workflow seeds and the Assistant Message action.
  • The filter replaces an existing site_autologin query parameter and preserves the rest of the URL. Invalid URL syntax renders empty. Configure attribution parameters on the destination URL as needed.
  • A Site on the shared path-based development host cannot receive a per-Site credential, because that host serves every Site from one origin. Links to one use the ordinary Site login screen instead. On dev-cloud this applies to managed-theme Sites; source Sites there have a host of their own.

These links authenticate the recipient. Do not forward them or reuse a rendered message for a different Member. Configure access to the destination's Forms, Workflows, and data through their normal permission settings.

Choose the destination Site explicitly by its workspace-local slug:

{{ 'enrollment-site' | site_url }}

The filter resolves the Site's current public URL from its workspace-local slug. It issues no credential. A missing Site fails the send. Authentication methods and Form bindings are configured on the Site. A2P Brand selection does not choose the destination.

enum_label — show the readable label of a select-field value​

Form fields of type Select and Multi-select store values as short slugs (e.g. high, follow_up_needed). Use enum_label to render the human-readable label the field was configured with instead of the slug.

{{ member.data.call_log.call_reason | enum_label('call_reason', 'call_log') }}
→ "Appointment follow-up"

{{ record.data.status | enum_label('status') }}
→ "Awaiting Response"

How to use it:

  • First argument: the field slug inside the data type.
  • Second argument (optional): the data type slug. You can omit it when the template is rendered in the context of a record of that data type (event rules on records, record-scoped actions).

Behavior:

  • Works with member.data.*, member.collections.*.latest.data.*, record.data.*, and any other enum value.
  • Falls back to the raw value if the field, option, or data type can't be resolved — it never errors.
  • Respects workspace permissions — if the template executes under a role that can't read the referenced data type, the filter falls back to the raw value instead of leaking the label.

See rendering contexts for the values available to each template.