Special characters such as double quotes ("), apostrophes (') and forward slashes (/) can break how Docs Made Easy reads an {{IF}} condition. To use them in a condition value, replace each one with an escape sequence.
Why it happens
The native {{IF}} syntax uses certain characters as part of its structure. A Salesforce field value can contain the same characters as part of the actual value, for example:
Medium Pot"Pencil'50% Off/Clearance
If you type these characters directly in a condition, the Word field-code parser or the Docs Made Easy condition parser can read them as syntax. The condition then fails and document generation can break.
Escape sequences solve this. You write each reserved character as a placeholder code in the template, and Docs Made Easy converts the code back to the original character during document generation.
Escape sequences
| Character | Description | Escape sequence | Example |
|---|---|---|---|
| " | Double quote | _x0022_ | Medium Pot_x0022_ |
| ' | Apostrophe or single quote | _x0027_ | Pencil_x0027_ |
| / | Forward slash | _x002F_ | 50% Off_x002F_Clearance |
Examples
Escape a value inside a table row condition
To show "This is Awesome" when a line item's product is either Pen" (with a trailing double quote) or Pencil' (with a trailing apostrophe), add this to the table row:
{{TableStart:Opportunity.r.OpportunityLineItems}} {{IF|Product2.Name|EQ|Pen_x0022_|OR|Product2.Name|EQ|Pencil_x0027_}} This is Awesome {{ELSE}} not worked {{ENDIF}} {{TableEnd:Opportunity.r.OpportunityLineItems}}
In this example, _x0022_ replaces the trailing " in Pen", and _x0027_ replaces the trailing ' in Pencil'. The condition then compares the actual Salesforce value without mistaking the special character for syntax.
Escape a value outside a table
Escape sequences also work when the {{IF}} condition is outside a table. To show "Opportunity is Fantastic" only when the opportunity name is Confirmed Opportunity", use:
{{IF|Opportunity.Name|EQ|Confirmed Opportunity_x0022_}} Opportunity is Fantastic {{ELSE}} Better Luck NT {{ENDIF}}
_x0022_ represents the trailing double quote, so the condition is read correctly.
Related: A guide to native conditional statements · Use Word IF fields