FormWork documentation

Template Syntax

Use references, merge fields, conditions, loops, and formatters in FormWork templates.

FormWork templates support merge values, formatters, conditions, and loops. The editor can insert references and formatters so you rarely need to memorise the syntax.

Output a value

Use double braces:

Hello {{ template.customer.name }}
Entry {{entry:current.id}}
Total £{{entry:current.answers.total|floatformat:2}}

template.* values come from the workflow’s Template Data mapping. entry:, form:, data_table:, workflow:, and iteration: are FormWork references resolved before rendering.

Defaults and formatters

Apply filters with |; pass a parameter with ::

{{ template.customer.name|default:"Customer" }}
{{entry:current.answers.name|upper}}
{{entry:current.answers.total|floatformat:2}}
{{entry:current.answers.lines|pluck:"name"|join:", "}}

The reference editor offers every formatter below when it is compatible with the current value:

FormatterResultArgument
pluckExtract one property from each object in a listProperty name
joinJoin a scalar list into textSeparator
defaultSubstitute a fallback for an empty valueFallback text
upper / lowerChange text caseNone
capfirstCapitalise the first characterNone
first / lastSelect one item from a scalar listNone
lengthCount a scalar or object listNone
truncatewordsLimit text to a number of wordsWord count
truncatecharsLimit text to a number of charactersCharacter count
floatformatFormat decimal placesNumber of places
yesnoMap a boolean-like value to labelsComma-separated labels, such as Yes,No
dateFormat a date/time valueGo-style layout, such as 2006-01-02

FormWork also adds display, which renders integers/floats without unnecessary trailing zeroes. It is normally applied automatically, while pluck is available explicitly in the formatter picker.

Bare numeric field references use compact display automatically unless an explicit display/number/date formatter is already present.

Conditions

{% if template.total > 1000 %}
  Priority order
{% elif template.total > 0 %}
  Standard order
{% else %}
  No charge
{% endif %}

FormWork references may appear inside control tags:

{% if {{entry:current.answers.status}} == "approved" %}
  Approved
{% endif %}

Loops

{% for item in template.items %}
  <p>{{ item.name }} — {{ item.quantity }}</p>
{% endfor %}

Or loop over a FormWork collection reference:

{% for row in {{data_table:products.rows[status=active]}} %}
  <p>{{ row.cells.name }}</p>
{% endfor %}

Inside loops, use the variable name you declared. Loop metadata is also available for counters and first/last checks.

Merge schema

Every template.<path> tag contributes to the template’s generated merge schema. Nested paths create objects; loop usage can establish arrays. The workflow mapping builder then exposes these leaves as targets.

Keep merge names stable after workflows begin using a template. Renaming template.customer.name to template.contact.name changes the mapping contract.

Layout content token

{{ content }} is reserved for layout composition. It does not create a merge-field mapping. A layout cannot be saved without it.

Client content fields

Heading, Paragraph, Button, and HTML fields can use Template content mode. Their FormWork references use the current entry and repeater instance. If a value cannot be resolved, the affected block is empty rather than preventing the rest of the form from loading. Unsafe HTML is removed before display.

Publish validation rejects a template-mode content field that directly references itself or forms a cycle with another template content field.

Safety and debugging

  • Prefer the picker over hand-typed IDs.
  • Use explicit defaults for optional merge values.
  • Test empty collections and missing optional answers.
  • Keep HTML email/PDF structure valid after conditions remove blocks.
  • Inspect Workflow Runs for the resolved mappings and any failure.
  • Use the template’s Usage tab before renaming merge fields or saving a breaking change.

For full reference selectors and filters, see References & Data.