A Guide to DME Native Conditional Statements

Overview

Conditional statements let you show or hide sections of a Word template based on the underlying Salesforce

data. Instead of maintaining several near-identical templates for different scenarios, you build one template that

adapts itself — displaying only the text, clauses, or tables that are relevant to each record. 


This is especially useful for:


- Displaying a discount clause only when a Discount field is greater than zero.

- Including specific payment terms for certain customer types.

- Personalizing greetings, disclaimers, or offers based on account or contact details.

- Filtering rows in a related-object table so only matching records appear.


Why it matters


One template, many outcomes. Conditional logic removes the need to duplicate and maintain multiple versions

of the same document, reducing errors and saving time.


Basic Syntax


Every conditional block follows the same three-part structure:


{{IF|Field|Operator|Value}}

   Content shown when the condition is TRUE

{{ELSE}}

   Content shown when the condition is FALSE

{{ENDIF}}


Supported Operators


Use these operators to build the comparison inside an IF block:

OperatorMeaningWhat it does
EQEqual toChecks whether two values are exactly equal.
NEQNot Equal toChecks whether two values are different.
GTGreater thanChecks whether a value is greater than record value.
GTEGreater than or equal toChecks whether a value is greater than or equal to record value.
LTLess thanChecks whether a value is less than record value.
LTELess than or equal toChecks whether a value is less than or equal to.
CONTAINSContainsChecks whether a text value contains a specified substring.
STARTSWITHStarts withChecks whether a text value begins with a specified string.
ENDSWITHEnds withChecks whether a text value ends with a specified string.
ISNULLIs nullChecks whether a field has no value (is null or empty).
ISNOTNULLIs not nullChecks whether a field contains a value (is not empty).


Worked Examples

Example 1 — Simple Comparison (EQ)

Show account details only when the account type is exactly "Customer - Direct"; otherwise show a fallback message.


{{IF|Account.Type|EQ|Customer - Direct}}

Account Name: {{Account.Name}}

Account Number: {{Account.AccountNumber}}

{{ELSE}}

This account is not a Direct Customer.

{{ENDIF}}


Result - If Account Type = "Customer - Direct", the account name and number are printed. Otherwise, the message "This

account is not a Direct Customer." is shown instead.



Example 2 — Combining Conditions (AND / OR)

Multiple conditions can be combined with AND or OR to build more precise rules.


{{IF|Account.Type|EQ|Customer - Direct|AND|Account.ContactEmail__c|CONTAINS|@gmail.com}}

Customer Name: {{Account.Name}}

Email: {{Account.ContactEmail__c}}

Eligible for Gmail Customer Offer.

{{ELSE}}

Condition Not Matched.

{{ENDIF}}


Result - Both conditions must be true for the offer text to appear; if either one fails, "Condition Not Matched." is shown.



Example 3 — Conditions Inside a Related-Object Table

Conditional logic also works inside table rows generated from a related list — useful for customizing individual rows rather than the whole table. In the example below, each contact's row prints their first name, unless it is "Jane", in which case it prints "InvalidName" instead.


First NameLast Name
{{TableStart:Account.r.Contacts}}
{{IF|FirstName|EQ|Jane}}InvalidName{{ELSE}}{{FirstName}}{{ENDIF}}
{{LastName}}{{TableEnd:Account.r.Contacts}}

Every row in the Contact related list prints its own FirstName and LastName — except rows where FirstName is

"Jane", which display "InvalidName" instead.



Note:

  • Always close every {{IF}} with a matching {{ENDIF}} — unclosed blocks will break document- generation.
  • Keep field API names exact — conditions are case- and spelling-sensitive.
  • Use {{ELSE}} to provide a graceful fallback instead of leaving blank space in the final document.
  • Test each template with sample records that cover both the true and false paths before using it.









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