How to Insert Conditional Statements in a Word Document Template

Created by Docs Made Easy, Modified on Fri, 19 Sep at 9:15 AM by Docs Made Easy

Conditional statements allow you to dynamically control what content appears in a generated document based on the values of Salesforce fields or parameters. This ensures that documents are context-specific and tailored for each recipient without requiring multiple template versions.


Step 1: Open your template in MS Word.


Step 2: Navigate to the Insert tab and click on Quick Parts.



Step 3: Select Field… from the dropdown.



Step 4: In the Field Name list, choose IF and click OK.



Step 5: Right-click on the placeholder text (Error! Missing test condition) and select Toggle Field Codes. 

Step 6: Enter your conditional statement logic.


Example:


If UpsellOpportunity__c field is Yes then a different text to be shown else some other text.



Step 7: Right-click on the placeholder text (Error! Missing test condition) and select Toggle Field Codes.



✅ Your template is now ready to use with conditional statements.


OUTPUT 1



OUTPUT 2




We hope this helps!




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article