DRTE Sections Editor

Published on June 3, 2026 DRTE



Sections Editor: Administrator & Template Editor Guide

Objective: Enable the Template Sections Editor workspace on the Rich Text Button/Document Template object record page, and learn how to define dynamic templates with sections and RichTables.

The Sections Editor lets you turn a static Word document into a dynamic, data-driven Salesforce template. Each section of the document can pull live data from Salesforce through its own SOQL query, and the merged output can be previewed before it is ever sent to a customer. This guide is split into three parts: Part 1 for the Salesforce Administrator (one-time setup), Part 2 for the Template Editor (building templates), and Part 3 for configuring RichTables (dynamic tables of related records).

What you will learn: Page setup (Admin), document ingestion, data architecting with the Query Builder, content mapping, validation, and RichTable configuration.

Quick Overview: Who Does What

RoleResponsibilityWhere
AdministratorAdds the pscdSectionEditor component to the record page and activates itLightning App Builder
Template EditorUploads DOCX, builds queries, maps fields, configures RichTables, validatesDocument Sections Editor tab

Watch the Demo

Watch a comprehensive user demo (how to use):

https://www.youtube.com/watch?v=AohE41QYNjU


Part 1: Administrator (Setup)

Role: Salesforce Administrator. Time required: about 5 to 10 minutes. This is a one-time configuration that gives your template editors their workspace.

1. Environment Setup

To provide the Template Editor with their workspace, you must configure the Lightning Record Page:

  1. Access App Builder: Go to the Rich Text Button/Document Template object, open any record, click the gear icon and choose Edit Page to launch Lightning App Builder.
    Edit the record page in App Builder
    Editing the Rich Text Button/Document Template record page.
  2. Tab Creation: Add a new tab to the layout. Label it "Document Sections Editor" to maintain standard naming conventions. A dedicated tab keeps the editor separate from the standard record details and gives it the full width of the page.
  3. Component Deployment: Locate the pscdSectionEditor under the "Custom - Managed" components section in the left panel. Drag and drop it into the newly created tab.
    Drag pscdSectionEditor into the tab
    Adding the pscdSectionEditor component to the new tab.

2. Component Activation

  1. Visibility: If the editor should only be visible for certain template types, use Component Visibility filters. This is optional, but useful when only some templates are built with sections.
    Component visibility filters
    Setting Component Visibility filters.
  2. Save & Desktop Assignment: Save the changes and ensure the page is activated as the Org Default or assigned to the specific App used by your design team. Without activation, editors will not see the new tab.
IMPORTANT: The Category field on the Template record has been repurposed to store the Object API Name of the Master/Base object. The editor uses this value to know which object your queries start from, so the field is strictly reserved for the API Name and must follow standard Salesforce naming conventions:

Category field holds the Object API Name
Category field storing the Object API Name.

Setup Checklist: (1) pscdSectionEditor added to a tab, (2) tab labelled "Document Sections Editor", (3) page activated for the right app/profile, (4) Category field set to the correct Object API Name.

Part 2: Template Editor

Role: Document Designer & Logic Architect

Objective: Transform static Word documents/manual sections into dynamic, data-driven Salesforce templates. The typical flow is: upload, define data, place merge fields, then validate.

1. Document Ingestion

Start by converting your existing business assets into the system:

  1. Upload: Use the Upload DOCX button to bring in a Microsoft Word file. The engine will split the document into editable RichText sections. Headings and structure in the Word file guide how sections are divided.
    Upload DOCX
    Uploading a DOCX file.
  2. Commit: You must click the blue Save button in the header after uploading or making any changes to finalize the creation of these sections in Salesforce. Unsaved changes are lost if you leave the page.
    Save button
    Saving to finalize the sections.

2. Data Architecting (The Query Builder)

This step defines what data is "available" to be merged into your document. Each section has its own query, so a section only exposes the fields it needs:

  1. Initialize: Click the Settings icon on a specific section and select Build Query.
    Build Query
    Opening Build Query from section settings.
  2. Object Mapping: Search for and select the Salesforce Object you are reporting on (e.g., Opportunity or Order).
    Select object
    Selecting the object.
  3. Field Selection: Choose all fields needed for this specific section.
    Select fields
    Choosing fields for the section.
  4. The {pv0} Constraint: To ensure the document pulls data from the record you are currently viewing, you must add a WHERE condition: Id equals {pv0}. At generation time, {pv0} is replaced with the ID of the record the document is being created for.
    WHERE Id equals pv0
    Adding the Id equals {pv0} condition.
  5. Save Logic: Click Save in the modal to inject the SOQL code into the section's configuration.
    Save query
    Saving the query.
    Saved query result
    The SOQL injected into the section configuration.
Do not skip the filter: A query without Id equals {pv0} will not be tied to the current record, so the merged document may show missing or incorrect data.

3. Content Design & Mapping

Now, link the data to your text layout:

  1. Insert Placeholders: In the Rich Text Editor, place your cursor where the data should appear. Use the Insert Field... dropdown to select the fields you chose in the Query Builder. Each field is inserted as a merge placeholder that is replaced with real data at generation time.
    Insert Field dropdown
    Inserting merge fields.
  2. Styling: Use the toolbar to apply branding, font styles (Sans Serif is default), and paragraph alignment.
    Styling toolbar
    Styling toolbar.
  3. Advanced HTML: If you need specific formatting (like custom CSS or table widths), click <Edit HTML> to modify the raw source code. Take care not to alter or delete the merge placeholders.

4. Validation & Quality Control

Always validate before releasing a template for real use:

  1. Preview: Use the Preview Document button at the top of the page (make sure you have defined the Test SFDC Record Id in the details tab). This is your "Sandbox" mode to verify that {{Field_Names}} are replaced by actual data values.
    Preview Document
    Previewing the document.
  2. Logic Check: Verify that dates, currency, and lookup names (e.g., Account.Name) are rendering correctly.
    Logic check
    Verifying rendered values.
  3. Version Control: Use the Export Sections feature to download a JSON backup of your work before making major structural changes.
Design Tip: If you need to pull data from a related parent object (e.g., the Account Name from an Order), ensure you select the Relationship Fields tab within the SOQL Query Builder during Step 2.

Part 3: Configuring RichTables

Goal: Create dynamic, styled data tables for related lists (e.g., Order Products, Quote Lines). Unlike a normal text section, a RichTable repeats one row for every related record found.

1. Initializing the Table

Instead of a standard paragraph, you can insert a structured data grid:

  1. Insert Table: In the Section Editor toolbar, click the + button (or use the "Rich Table" menu item to select a Table type).
    Insert Rich Table
    Inserting a RichTable.
  2. Selection: This creates a dedicated RichTable block within your document section, specifically designed to iterate through multiple records.

2. Data Mapping (Table-Specific SOQL)

Just like paragraph/Rich Text blocks, tables require a data source, but they usually target Child Objects (or any related SFDC Object):

  1. Build Query: Open the Query Builder within the RichTable settings.
    RichTable Build Query
    Opening the RichTable Query Builder.
  2. Target Child Records: Select a child object (e.g., Negotiated Rate).
  3. Relational Filtering: Set the filter so the parent ID matches the current record. Example: OrderId equals {pv0}.
    Relational filter
    Filtering child records by the parent ID.
  4. Field Selection: Choose the columns you want to display (e.g., Product Name, Quantity, Unit Price, Total Price).
    Select table columns
    Choosing display columns.

3. Table UI & Column Configuration

Once the query is saved, the RichTable interface allows for granular UI control:

  1. Column Mapping: The fields from your SOQL query appear as available columns.
    Column mapping
    Available columns from the query.
  2. Header Customization: You can manually rename the headers (e.g., changing "Name" to "Role") so the printed table uses business-friendly labels.
    Header customization
    Renaming column headers.
  3. Styling & Alignment: Use the columns and table style tab settings to:
    • Set Column Widths (fixed or percentage).
    • Set Text Alignment (e.g., right-aligning currency values).
    • Apply custom borders for better readability.
    Table style settings
    Table style and alignment settings.

4. Previewing the Table

When you click Preview Document to test, the RichTable will:

  1. Identify the child records related to the current record, as defined in the SOQL query.
  2. Dynamically generate the necessary number of rows.
  3. Apply the styles and headers you defined.
    RichTable preview
    Preview of the generated RichTable.
Editor Tip: If a table has too many columns for a standard Portrait page, use the <Edit HTML> option or the Table Style Tab Properties to set the width to 100%.

Frequently Asked Questions & Troubleshooting

Q: I don't see the Document Sections Editor tab.
Confirm the Lightning page was saved and activated for your app/profile, and that Component Visibility filters are not hiding it.
Q: My sections disappeared after uploading a DOCX.
Click the blue Save button after uploading to commit sections to Salesforce.
Q: Preview shows blank or wrong values.
Check that the Test SFDC Record Id is set, the query includes Id equals {pv0}, and the Category field holds the correct Object API Name.
Q: My RichTable shows no rows.
Verify the child object filter (e.g., OrderId equals {pv0}) and that the test record actually has related child records.

Key Takeaways


Knowledge Article Number: KA-00225

View more articles in the knowledge base