DRTE v5.137 (GA)
Published on April 21, 2026 DRTE
DRTE v5.137 Release Notes
What’s New
1. TemplateEngine: Dynamic HTML Conditional Rendering
2. New Source HTML Action Buttons: Minify and Indent in HTML Content Builder
A. TemplateEngine: Dynamic HTML Conditional Rendering
Purpose
Process HTML templates with Salesforce SOQL data and render conditional blocks dynamically.
Overview
TemplateEngine is a lightweight conditional rendering engine that processes HTML strings containing special template tags. It evaluates if/else conditions against Salesforce SOQL record data and returns the appropriate HTML block, without modifying any content outside the conditional blocks.
How It Works
The engine follows a simple three-step pipeline:
| 1. SOQL Response | 2. HTML Template String | 3. Rendered HTML Output |
| JSON from SOQL query | Contains {{#if}}, {{else}}, {{/if}} tags and field placeholders | Conditional blocks resolved |
1. Template Syntax
a. Basic If Block
Use when you want to show content only when a condition is true, and nothing otherwise.
{{#if FieldName}}
Content to show when condition is true
{{/if}}
b. If / Else Block
Use when you want different content depending on whether the condition is true or false.
{{#if FieldName == 'Value'}}
Content when condition is TRUE
{{else}}
Content when condition is FALSE
{{/if}}
c. Template From Salesforce Rich Text Editor
When the HTML string comes from the Salesforce Rich Text Editor (RTE), special characters are automatically HTML-encoded. The engine handles this transparently and no manual decoding is needed.
<!-- RTE encodes single quotes as ' -->
{{#if Account.BillingStreet == 'Rajasthan'}}
Rajasthan Office
{{else}}
{{Account.BillingStreet}}
{{/if}}
d. Multiple Blocks in One Template
A single HTML string can contain multiple independent conditional blocks. Each is processed separately.
{{#if IsPaid__c}}
<span class='badge green'>PAID</span>
{{else}}
<span class='badge red'>UNPAID</span>
{{/if}}
{{#if StageName == 'Prospecting'}}
<p>Early stage opportunity</p>
{{/if}}
{{#if Amount > 50000}}
<div class='highlight'>High Value Deal</div>
{{else}}
<div>Standard Deal</div>
{{/if}}
2. Condition Expressions
Conditions are written inside {{#if ... }} and support a wide range of comparisons and field types.
3. Supported Operators
| Operator | Meaning | Example |
| == or === | Equal to | StageName == 'Prospecting' |
| != or !== | Not equal to | Status__c != 'Closed' |
| > | Greater than | Amount > 10000 |
| >= | Greater than or equal | Amount >= 50000 |
| < | Less than | Amount < 1000 |
| <= | Less than or equal | Discount__c <= 20 |
| && | AND: both must be true | IsPaid__c && Amount > 1000 |
| || | OR: at least one true | StageName == 'Closed' || Amount > 99999 |
4. Field Types
| Field Type | Example Condition | Notes |
| String / Text | StageName == 'Active' | Wrap string values in single quotes |
| Number / Currency | Amount > 50000 | No quotes; compared as numeric |
| Boolean (Checkbox) | IsPaid__c | Field alone: true if checked, false if not |
| Boolean explicit | IsPaid__c == true | Explicit comparison also works |
| Null / Empty field | Website | Returns false if field has no value |
| Relational field | Account.BillingStreet == 'Rajasthan' | Use dot notation for relationship fields |
5. Compound Conditions
Combine multiple conditions using && (AND) or || (OR).
<!-- AND: both conditions must be true -->
{{#if StageName == 'Prospecting' && Amount > 10000}}
High-value early stage deal
{{/if}}
<!-- OR: at least one condition must be true -->
{{#if StageName == 'Closed Won' || IsPaid__c}}
Revenue confirmed
{{else}}
Pending
{{/if}}
6. Field References
6.1 Standard Salesforce Fields
Use the Salesforce API field name exactly as returned by the SOQL query.
<!-- Direct fields on the queried object -->
{{#if Name}}...{{/if}}
{{#if StageName == 'Closed Won'}}...{{/if}}
{{#if Amount > 5000}}...{{/if}}
{{#if IsPaid__c}}...{{/if}} <!-- custom checkbox field -->
{{#if Status__c == 'Active'}}...{{/if}} <!-- custom picklist field -->
6.2 Relationship / Referential Fields
Access fields from related objects using dot notation. This matches the SOQL query structure.
<!-- SOQL: SELECT Id, Name, Account.BillingStreet FROM Opportunity -->
{{#if Account.BillingStreet == 'Rajasthan'}}
Rajasthan Office
{{else}}
{{Account.BillingStreet}}
{{/if}}
Example:
{{#if Owner.Name == 'John Doe'}}
Owned by John
{{/if}}
6.3 Null / Empty Fields
If a field has no value in Salesforce, it evaluates as false in a condition. The else block (if present) will be rendered.
<!-- Account.Website has no value -->
{{#if Account.Website}}
<a href='{{Account.Website}}'>Visit Website</a>
{{else}}
No website on file
{{/if}}
Result: 'No website on file'
7. Engine Behaviour Reference
7.1 What the “If” Processing Returns
| Scenario | Returns | Notes |
| Condition is true, truthy block exists | Truthy block content (raw) | - |
| Condition is false, else block exists | Else block content (raw) | - |
| Condition is false, no else block | Empty string "" | Block removed entirely |
| Field is null/missing | Evaluates as false | Goes to else block or returns empty |
| Field exists with any value | Evaluates as true | For non-boolean truthy check |
7.2 What Is NOT Processed
Out of scope: nested {{#if}} inside another {{#if}}.
8. Full Examples
8.1 Invoice Status Document
<!-- SOQL: SELECT Id, Name, IsPaid__c, Amount, Account.BillingStreet FROM Opportunity -->
<div class='document'>
{{#if IsPaid__c}}
<span class='badge green'>PAID</span>
{{else}}
<span class='badge red'>UNPAID</span>
{{/if}}
{{#if Amount > 50000}}
<div class='highlight'>High Value Account</div>
{{/if}}
{{#if Account.BillingStreet == 'Rajasthan'}}
<p>Rajasthan Regional Office</p>
{{else}}
<p>{{Account.BillingStreet}}</p>
{{/if}}
</div>
8.2 Opportunity Stage Section
<!-- SOQL: SELECT Id, Name, StageName, Amount FROM Opportunity -->
{{#if StageName == 'Closed Won'}}
<div class='success'>
<h2>Deal Closed</h2>
<p>Congratulations on closing {{Name}}!</p>
</div>
{{else}}
{{#if StageName == 'Prospecting' && Amount > 10000}}
<div class='priority'>Priority Prospect - Follow Up Required</div>
{{else}}
<div class='standard'>{{Name}} - Stage: {{StageName}}</div>
{{/if}}
{{/if}}
8.3 Iterate HTML for Multiple Records
When the section is set to iterate HTML for records, the same template is processed once per SOQL result row.
<!-- Template applied to each record in SOQL results -->
<div class='record-row'>
{{#if StageName == 'Qualification'}}
<strong>{{Name}}</strong>
{{else}}
No Name
{{/if}}
</div>
<!-- Output for record 1 (StageName = Prospecting): -->
<div class='record-row'>No Name</div>
<!-- Output for record 2 (StageName = Qualification): -->
<div class='record-row'><strong>{{Name}}</strong></div>
9. Common Mistakes & How to Avoid Them
| Mistake | Wrong | Correct |
| Field not in SOQL query | {{#if Website}} but Website not in SELECT | Add Website to SOQL: SELECT Id, Name, Website FROM Account |
| Missing quotes around string value | {{#if StageName == Prospecting}} | {{#if StageName == 'Prospecting'}} |
| Wrong API field name casing | {{#if stagename == 'Prospecting'}} | {{#if StageName == 'Prospecting'}} |
| Relational field not queried | {{#if Account.BillingStreet == 'X'}} but no Account.BillingStreet in SELECT | SELECT Id, Account.BillingStreet FROM Opportunity |
10. Quick Reference Card
| Template Syntax | Key Rules |
| {{#if Field}}...{{/if}} {{#if Field}}...{{else}}...{{/if}} {{#if Field == 'Value'}}...{{/if}} {{#if Amount > 1000}}...{{/if}} {{#if IsPaid__c}}...{{/if}} {{#if A == 'x' && B > 10}}...{{/if}} {{#if A == 'x' || B == 'y'}}...{{/if}} | - Field names are case-sensitive (use API name) - String values must be in single quotes - Numeric values need no quotes - Boolean fields: use field name alone - Null fields evaluate to false - RTE encoded characters are decoded automatically - {{Field}} outside if blocks is returned as-is - {{Field}} inside a matched block is returned as-is |
B. Source HTML Action Buttons: Minify and Indent in HTML Content Builder
The Source HTML view in HTML Content Builder now includes Minify and Indent action buttons to compress or format your HTML source.
Source HTML action buttons: Minify and Indent in HTML Content Builder.
Knowledge Article Number: KA-00224