When using IF conditions in Docs Made Easy templates, special characters such as double quotes ("), apostrophes ('), and forward slashes (/) may interfere with how a condition is parsed.
To prevent this, Docs Made Easy supports escape sequences that allow these characters to be safely used within condition values.
Overview
The Docs Made Easy conditional {{IF}} syntax uses certain characters as part of its structure. If one of these reserved characters appears within the value being compared, the condition may not be interpreted correctly.
For example, a Salesforce field value may contain a quotation mark or apostrophe as part of the actual value:
- Medium Pot"
- Pencil'
- 50% Off/Clearance
If these characters are entered directly inside a condition, the Word field-code parser or Docs Made Easy condition parser may interpret them as part of the syntax, which can cause the condition to fail and document generation to break.
To handle this, Docs Made Easy provides an escape-sequence system. Before the template is processed, reserved characters are represented using safe placeholder codes. During document generation, these codes are converted back to their original characters.
| Character | Description | Escape Sequence | Example |
| " | Double quote | _x0022_ | Medium Pot_x0022_ |
| ' | Apostrophe / single quote | _x0027_ | Pencil_x0027_ |
| / | Forward slash | _x002F_ | 50% Off_x002F_Clearance |
Examples:
Example 1: Escaping a Value Inside a Table Row Condition Suppose you want to display "This is Awesome" when the line item's product is either: Pen" — with a trailing double quote Pencil' — with a trailing apostrophe | |
| |
| In this example: - The trailing " in Test Product 5" is replaced with _x0022_. - The trailing ' in Pencil' is replaced with _x0027_. This allows the condition to evaluate the actual Salesforce value without confusing the special character with the condition syntax. |
Example 2: Escaping a Value Outside a Table Escape sequences can also be used when the {{IF}} condition is outside a table. suppose you want to display "Opportunity is Fantastic" only when the Opportunity Name is: Confirmed Opportunity" |
{{IF|Opportunity.Name|EQ|Confirmed Opportunity_x0022_}} Opportunity is Fantastic {{ELSE}} Better Luck NT {{ENDIF}} |
| The trailing double quote is represented by _x0022_, allowing the condition to be parsed correctly. |
Note:
- This feature can be used only with DME native IF Conditions; standard DOCX IF conditions are not supported.
- Only escape characters inside the Value portion of a condition — never escape the pipe characters that separate Field | Operator | Value, since those are the intended delimiters.
- Escape every occurrence of a reserved character in the value, not just the first one.
- Keep the escape code exactly as shown (e.g. _x0022_) — it is case-sensitive and must include the leading and trailing underscore.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article