# Conditions and alternative content 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](#choose-data). For an orientation and the format checklist, open [Find the right merge tag](#merge-tags). #### 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. --- Related articles - [Find the right merge tag](https://portwood.dev/knowledgebase/merge-tags.md) - [Choose the information in a document](https://portwood.dev/knowledgebase/choose-data.md) - [Fix a document](https://portwood.dev/knowledgebase/fix-document.md) [Browse the article directory](https://portwood.dev/knowledgebase/)