Template conditions control which text displays in a CommunitySuite template based on whether a specified condition is met. Conditions are applied to merge fields within a Word document and use if-then-else logic to show or hide content depending on record data. Templates Overview outlines the full template process.
Who: All CommunitySuite users who manage templates.
When to Use Template Conditions
Use template conditions to:
- Display or hide fields based on whether data exists.
- Show different text based on record values.
- Control whether a table or section appears based on a calculated value.
Add a Merge Block
To add conditional formatting to a template, a merge block must be inserted into the Word document first. Two methods are available.
Ctrl + F9
Press Ctrl + F9 on your keyboard. This inserts brackets and a highlighted field, which are the identifying characteristics of a merge block.
Quick Parts
- Click Insert on the top ribbon, and then click Quick Parts.
- Click Field.
- Select the equals formula, uncheck Preserve formatting during updates, and then click OK.
- Right-click the field and click Toggle Field Code.
Conditions
= equals
<> does not equal
< less than
> greater than
Merge Field Formulas
Merge field formulas allow you to perform calculations within a template using merge field values. Supported operations include addition, subtraction, division, and multiplication. Merge field formulas are intended for more complex and dynamic templates.
Basic Structure
A basic condition is structured like the following:
When this condition is true, display this text. Otherwise display this text.
- "" is equal to nothing.
To control line spacing within a condition, a carriage return can be inserted inside the condition so that content displays on the next line when the condition is true.
Examples
- In the example above, if tribute name is not equal to BLANK, then display This gift was given {{tribute_name}}, and if BLANK display nothing which is indicated by the last "".
- In the example above, if org contact label is equal to blank, then display nothing; and if not blank, then display org contact label on the next line because there is a carriage break (where the arrow is).
- In the fund statement example above, if donations total is greater than 0, then display this donations detail table; otherwise, display No donations for the statement period.
Template Conditions Videos
The videos below demonstrate how to add conditional formatting to CommunitySuite templates using merge blocks and if-then-else statements in Microsoft Word.
CommunitySuite Conditional Formatting Video
The video below covers how to use merge blocks and if-then statements in Microsoft Word to control whether fields like Address 2 appear based on whether data exists.
Conditional Formatting - IF Statements Video
The video below covers how to use if-then-else statements and merge field formulas in Word templates to display different content based on record data, such as donation type.