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 Response2. HTML Template String3. Rendered HTML Output
JSON from SOQL queryContains {{#if}}, {{else}}, {{/if}} tags and field placeholdersConditional 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 &#39; -->
{{#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

OperatorMeaningExample
== or ===Equal toStageName == 'Prospecting'
!= or !==Not equal toStatus__c != 'Closed'
>Greater thanAmount > 10000
>=Greater than or equalAmount >= 50000
<Less thanAmount < 1000
<=Less than or equalDiscount__c <= 20
&&AND: both must be trueIsPaid__c && Amount > 1000
||OR: at least one trueStageName == 'Closed' || Amount > 99999

4. Field Types

Field TypeExample ConditionNotes
String / TextStageName == 'Active'Wrap string values in single quotes
Number / CurrencyAmount > 50000No quotes; compared as numeric
Boolean (Checkbox)IsPaid__cField alone: true if checked, false if not
Boolean explicitIsPaid__c == trueExplicit comparison also works
Null / Empty fieldWebsiteReturns false if field has no value
Relational fieldAccount.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

ScenarioReturnsNotes
Condition is true, truthy block existsTruthy block content (raw)-
Condition is false, else block existsElse block content (raw)-
Condition is false, no else blockEmpty string ""Block removed entirely
Field is null/missingEvaluates as falseGoes to else block or returns empty
Field exists with any valueEvaluates as trueFor 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

MistakeWrongCorrect
Field not in SOQL query{{#if Website}} but Website not in SELECTAdd 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 SELECTSELECT Id, Account.BillingStreet FROM Opportunity

10. Quick Reference Card

Template SyntaxKey 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.

Minify and Indent buttons in HTML Content Builder Source HTML
Source HTML action buttons: Minify and Indent in HTML Content Builder.


Knowledge Article Number: KA-00224

View more articles in the knowledge base