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

How to Format Text, Dates, and Currency

Format dates, numbers, checkboxes, and uppercase billing output with merge field attributes.

Use this tutorial when you want one template to control how values render in the document body.

What it looks like

After setup, one generated invoice gives the user all of this:

  • A readable invoice date, such as April 9, 2026

  • A formatted amount, such as $4,222,300.80

  • Checkbox icons for payment options

  • An uppercase billing block for customer details

  • Reusable merge field patterns you can copy into other templates

This is the right end state for invoice, quote, and order templates that need clean output without changing the source data.

When to use template attributes

Use template attributes when you need to change how a field renders inside the template body.

Best for:

  • Formatting dates and numbers for business documents

  • Showing checkbox or radio output from boolean fields

  • Transforming text case without changing Salesforce data

  • Reusing the same merge field pattern across similar fields

Use another feature when the problem is different:

Build an invoice template with template attributes

What you'll configure

  • Basic merge field structure

  • format-date for invoice date

  • format-number for currency values

  • checkbox for payment options

  • ToUpperCase for billing fields

Estimated time: 20 minutes

Prerequisites

Before you start, make sure you have:

  • Access to S-Docs Templates

  • Permission to create or edit templates

  • An S-Docs template related to Opportunity

  • A test Opportunity with an Amount, Close Date, and Account

  • Basic familiarity with merge fields such as {{!Opportunity.Name}}

If you are brand new to S-Docs syntax, start with a basic merge field tutorial first.

1

Step 1: Open or create the template

Start with an Opportunity template that will generate an invoice.

  1. Go to S-Docs Templates in Salesforce.

  2. Open an existing template or click New Template.

  3. Set Related To Type to Opportunity.

  4. Set Template Format to PDF.

  5. Open the template editor.

You now have a place to add template attributes in the document body.

2

Step 2: Start with plain merge fields

Start with raw values first. This makes the attribute changes obvious.

Add this near the top of the template:

What you just did:

  • Added three plain merge fields with no attributes

  • Confirmed the base object and field paths are correct

  • Created a before state for the next formatting steps

How to read the syntax:

  • {{! starts the merge field

  • Opportunity.CloseDate points to one field on the base record

  • Attributes come after the field path

  • }} closes the merge field

3

Step 3: Add a formatted invoice date

A date attribute turns raw Salesforce date output into invoice-ready text.

Add this near the top of the template:

What you just did:

  • Applied format-date to Opportunity.CloseDate

  • Used MMMM d, yyyy for month name, day, and four-digit year

  • Created a readable invoice header without changing the source field

Why this pattern matters:

  • The field path stays the same

  • Only the attribute changes the output

  • You can reuse this pattern on any date field

4

Step 4: Format the invoice amount

A number attribute lets you keep raw numeric data in Salesforce while showing clean currency in the document.

Add this below the date:

What you just did:

  • Applied format-number to the amount field

  • Added commas and two decimal places with #,###.##

  • Kept the dollar sign outside the attribute for predictable output

Pattern to remember:

  • Start with the raw field: {{!Opportunity.Amount}}

  • Add one space

  • Add the attribute: format-number="#,###.##"

  • Keep visible text, such as $, outside the merge field

5

Step 5: Add payment method checkboxes

Use checkbox attributes when the source field is a true Salesforce checkbox field.

If these fields do not exist yet, create Payment_by_Check__c and Payment_by_Credit_Card__c on Opportunity before continuing.

Then add this block:

What you just did:

  • Rendered boolean fields as checkbox icons instead of true or false

  • Kept the labels readable for the final document

  • Used a pattern you can swap to checkbox="black" or checkbox="radio" later

Merge field rule:

  • Put the label outside the merge field

  • Keep the checkbox attribute inside the same field

6

Step 6: Add an uppercase billing block

Text attributes are useful when the document needs a formal display style.

Add this below the invoice header or near the customer section:

What you just did:

  • Converted account name and address lines to uppercase in the output only

  • Left the postal code unchanged

  • Applied the same attribute pattern across several related fields

Pattern to remember:

  • Keep each field separate

  • Repeat the same attribute on each line you want transformed

  • Leave fields unchanged when you want their original display

7

Step 7: Test a few merge field variations

Once the base version works, swap one pattern at a time.

Try one of these date alternatives:

Try one of these number alternatives:

What you just did:

  • Reused the same merge field with different attributes

  • Changed output without changing the Salesforce data

  • Built patterns you can copy into quote or order templates

8

Step 8: Save and test the template

Generate the invoice from a real Opportunity before adding variations.

  1. Click Save in the template editor.

  2. Open a test Opportunity with the fields you used.

  3. Generate the template.

  4. Verify the output.

Check these results:

  • The invoice date uses a readable format

  • The amount shows commas and decimals

  • The payment fields render as checkboxes

  • The billing block appears in uppercase

  • The raw merge fields no longer appear in their default Salesforce format

Guardrails and limits

Merge field syntax rules

  • Always start with {{! and end with }}.

  • Always keep attributes inside the same merge field.

  • Always leave a space between the field name and the first attribute.

  • Always keep markup outside the merge field.

  • If markup breaks the merge field, S-Docs prints the syntax as literal text.

Date and number formatting rules

  • Use lowercase yyyy for the year in format-date patterns.

  • Type currency symbols outside format-number.

  • If the pattern is wrong, values can render in an unexpected format or stay unformatted.

Checkbox and output limits

  • Use checkbox only with boolean fields.

  • Expect checkbox rendering to work best in PDF templates.

  • If you apply checkbox to the wrong field type, the document can show raw values instead of icons.

Testing rules

  • Generate one test document after each major syntax change.

  • Use a record with real values and known checkbox states.

  • If you skip testing, syntax problems usually surface only in final output.

Last updated

Was this helpful?