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:
| Formatter | Result | Argument |
|---|---|---|
pluck | Extract one property from each object in a list | Property name |
join | Join a scalar list into text | Separator |
default | Substitute a fallback for an empty value | Fallback text |
upper / lower | Change text case | None |
capfirst | Capitalise the first character | None |
first / last | Select one item from a scalar list | None |
length | Count a scalar or object list | None |
truncatewords | Limit text to a number of words | Word count |
truncatechars | Limit text to a number of characters | Character count |
floatformat | Format decimal places | Number of places |
yesno | Map a boolean-like value to labels | Comma-separated labels, such as Yes,No |
date | Format a date/time value | Go-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.