Conditions and alternative content
Use boolean blocks, comparisons, else, AND, OR, and NOT.
Read as Markdown · Open in the interactive guide
Use a condition when part of your document should appear only for certain records. Always test both outcomes and an empty value.
Before you start: Choose the fields and relationships in Choose information. For an orientation and the format checklist, open Find the right merge tag.
Conditionals
Boolean conditional
{#IsActive}
Account is active.
{/IsActive}
{#IsActive}
Active.
{:else}
Inactive.
{/IsActive}
Truthy values: Boolean true, non-empty lists, any non-null non-false non-empty-string value.
Inverse conditional
Show when falsy. Opposite of {#Field}.
{^Closed__c}
Still open.
{/Closed__c}
{^IsActive}
Inactive.
{:else}
Active.
{/IsActive}
IF comparison expressions
Supports >, <, >=, <=, = (or ==), !=. Values can be field refs, quoted strings, or numbers.
{#IF Amount > 100000}
Large deal — requires approval.
{/IF}
{#IF StageName = 'Closed Won'}
Congratulations!
{:else}
Keep pushing.
{/IF}
{#IF Priority != 'Low'}
Escalate this case.
{/IF}
String comparisons are case-sensitive.
AND / OR / NOT
Combine comparisons with boolean operators. Both word-form (AND, OR, NOT — case-insensitive) and symbolic form (&&, ||, !) work. Parentheses control precedence.
{#IF Amount > 100000 AND Stage = 'Negotiation/Review'}
Large deal in negotiation — escalate.
{/IF}
{#IF Stage = 'Closed Won' OR Stage = 'Closed - Pending Funding'}
Pipeline closed.
{/IF}
{#IF NOT IsPrivate__c}
Public record.
{/IF}
Default precedence (highest first): NOT → comparisons → AND → OR. Use parens to override:
{#IF (Amount > 100000 OR Strategic__c) AND IsClosed = false}
Large or strategic, still open.
{/IF}
Arbitrarily long chains and grouping work:
{#IF (Region = 'NA') OR (Region = 'EU' AND Tier__c = 'Gold') OR (Strategic__c)}
Eligible for premium support.
{/IF}
Quoted strings are opaque — AND / OR inside quotes is treated as part of the string, not as an operator.
Nested IF blocks
{#IF}…{/IF} blocks can be nested arbitrarily deep. Common pattern: an outer IF gates a whole section, inner IFs gate sub-sections within it.
{#IF Work_Tasks__r.totalSize != 0}
WORK TASKS
…table with Work Tasks loop…
{#IF Work_Task_Step_Count__c != 0}
…Steps table with Steps loop…
{/IF}
{/IF}
Rel.totalSize returns 0 (not null) when the child relationship is empty, so {#IF Rel.totalSize != 0} is the canonical "render this section if there are rows" check.