For the complete documentation index, see llms.txt. This page is also available as Markdown.

Merge Fields With Template Editor

Learn what merge fields are, how to add them to a template, and which attributes are most useful day to day.

Inserting Merge Fields

Merge fields pull live Salesforce data into an S-Docs template.

They act as placeholders. At generation time, S-Docs replaces them with record values.

What a merge field looks like

Use this pattern:

{{!Object.Field}}

Examples:

{{!Opportunity.Name}}
{{!Opportunity.Account.Name}}
{{!Contact.Email}}

You can also apply formatting attributes.

Example:

{{!Opportunity.CloseDate format-date="yyyy-MM-dd"}}

How to add a merge field

1

Choose the record value

Identify the object and field you want to merge.

Example: Opportunity.Name

2

Insert the merge field into the template

Place your cursor where the value should appear.

Then insert or type the merge field syntax:

{{!Opportunity.Name}}
3

Add an attribute if needed

Attributes change how the value renders.

Example:

{{!Opportunity.Amount format-number="#,###.##"}}
4

Save and test

Generate a document from a real record.

Confirm the value and formatting are correct.

Quick examples

Plain text field

Parent relationship field

Number formatting

Render rich text content

Replace characters or values

Quick reference: common merge field attributes

This is a practical reference. It covers the most commonly documented attributes.

replaceAll

Replaces matching text inside the merged value.

Use it for cleanup, escaping, or value swaps.

Use multiple pairs when needed.

Use #comma# if a replacement value must contain a comma.

format-number

Formats numeric output.

Useful for currency, decimals, phone-like masks, and localized separators.

Rich text output and triple braces

Use triple braces when you want to preserve formatting from a rich text field.

Use this when you want line breaks or markup to remain in the output.

format-date

Formats date and datetime values.

Example:

Use this when you need a predictable date format.

Common issues

  • Wrong object or field API name

  • Missing relationship path

  • Special characters not escaped

  • Rich text output not formatted as expected

Last updated

Was this helpful?