We are going to break down the training into 2 simple steps :
Prerequisites
BEFORE STARTING
Have a template already ready with the main object and a child object configured
Use a word template, be careful this feature is not available in Google Doc
Have the “shipping address” and “billing address” fields present in the template
WHY MAKE CONDITIONS?
A condition allows you to display or not display text, an image, a table, and other elements based on a criterion found in Salesforce. This is very useful to add a legal paragraph in the T&Cs based on a checkbox, for example in Salesforce, or to hide a part that shows the possible discounts when no discount has been applied in a quote.
The idea is to personalize a template without multiplying the number of different templates.
Simple display condition
Identifying logic
The logic in our example will be simple, we want to display the word “Apple” when the checkbox on the “Show the word Apple” account is checked.
Define the field that will be used next for the condition (The “multiple selection list”, “date”, and “text box” fields cannot be used in a condition)
Think about the logic you want
Find the document template on which you want to make the condition
Make sure that the main object & the child objects (optional) are properly configured
Open the assistant from the document template
Create the condition via the assistant
Using the assistant, find the Salesforce field that will be the basis of your condition
Click on the 3 small dots at the end of the line
Click on “Add a condition”
I complete the logic by entering the word “Apple” in the “True” box (True = Box checked)
I leave the “False” box empty to put nothing if the box is unchecked
Click on “Copy”
Inserting the condition in Word
Click on the “Insert” tab on the word ribbon
Click on “Fields...” or “Insert Field”
Accédez au pictogramme intitlulé "Quick parts", puis sur "Field..." (Sur Windows)
Now paste the condition in the editable area instead of the equal sign already present
Finalize by clicking on “Ok”
Note that it is the condition if false that will be displayed by default in the template but that the condition will execute according to our criterion at the time of generation.
Test your condition
Upload your template with the condition as usual when loading a new version
Find a record that matches your criteria (We check the box “Show the word Apple” on our account for the example)
Generate a document to validate that the condition works well
Systematically test all the alternatives for your condition to ensure that it has been well built
Use cases
Display of the word “Free” instead of 0€ in a table
We assume that we have a template with an array where there is a currency field to be able to make the condition. In our example, we use opportunity and opportunity products.
Make sure you have a main object as well as a child object configured
Open the assistant from the document template
Look for the field on your child object
Click on the 3 small dots and add a condition
Indicate “0" in the expected value
Text if true = Free
Text if false = [Re-enter the tag you want to display]
In the table in Word, position yourself where you want to insert the condition
Always access the same menu to insert a “Insert/Insert Field” field
Paste the condition into the editable area
Click on “Ok”
Finalize by uploading the template as usual
Test
Showing a checked or unchecked box in Word
We're starting with an example where we want to display a checkbox in the same way as in Salesforce.
Note that if we use emojis here but we could easily insert images, you simply have to make this change after having inserted the condition, toggle the field codes with a right click on the condition.
Display multiple fields dynamically
Same principle as before to insert the condition
Once the condition is inserted, right-click to “toggle field codes”
Move all of the parts you want to have dynamically into the “Text if true” or “Text if false” area according to your logic
Finalize by uploading the template as usual
Test
Advanced display conditions
Create multiple nested conditions (or, and, and +or), and display images, tables, pyctograms, checkboxes, or display a specific layout with advanced SI condition constructs.
Download the template for inspiration.
Download the conditions template and open it with Word.
Select the entire document (control + A) and right-click: toggle field codes to display conditions
Copy and paste the condition you want to use into your Word template.
Open the condition and change the values as needed: tag, operator, text if true, text if false
Close your condition by selecting it, via right click: update field codes
⬇ Download the SI conditions templateAre you having a problem with IF conditions?
Check out our help page: The Word IF condition inserted in the document does not trigger