đź§© Conditional sections in templates
Show or hide parts of a Word template depending on CRM values – with [if]/[else]/[endif] directly in the template.
You can show or hide parts of a Word template depending on CRM values – for example a paragraph only for won deals, a different salutation per contact or a discount note above a certain amount. Works both when generating from the CRM card and in workflow actions.
How it works
Simplest form:
[if deal.dealstage = "Closed Won"]
Thank you for your order.
[endif]
With an alternative:
[if deal.amount >= 10'000]
For this order volume we grant a 5 % discount.
[else]
Standard conditions apply.
[endif]
Several cases (the first true one wins):
[if deal.dealstage = "Closed Won"]
…
[elif deal.dealstage = "Contract Sent"]
…
[else]
…
[endif]
Within one line – then all tags of the condition must be on the same line:
Dear[if contact.salutation = "Mrs"] Mrs[elif contact.salutation = "Mr"] Mr[endif] [contact.lastname]
What you can check
Anything you can use as a placeholder – just written without square brackets:
the record itself:
deal.amountassociated objects, also with a label:
company(Primary).industryowners:
deal.owner.hs_emailthe current user:
currentuser.hs_emaildate and time:
today,CurrentYear,CurrentMonth
Comparisons
| Comparison | Example |
|---|---|
| equal / not equal | = "Closed Won", != "Closed Lost" |
| greater / smaller | > 5000, >=, <, <= |
| contains | contains "Ski", not contains |
| empty / not empty | is empty, is not empty |
| combine | and, or, not |
Text in quotes, numbers with . as decimal separator (10'000 uses a single quote as thousands separator). Upper and lower case don't matter for text.
Layout rules
Whole paragraphs, tables, images: put each tag (
[if …],[else],[endif]) on its own line. The tag lines disappear, so no empty lines are left.Part of a line: all tags of the condition on the same line.
Nesting is allowed. Works in body text, headers and footers, table cells and text boxes.
Errors are visible straight away
Wrong property names, missing [endif] or unreadable conditions show up as red error text in the generated document – so you spot them on the first test.
➡️ Related articles