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, 2026A formatted amount, such as
$4,222,300.80Checkbox 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:
Use Configure Document Generation Template Settings when you need file naming, save behavior, or page layout.
Use Getting Started with Conditional Logic when content should appear only when conditions pass.
Use Get Started with Calculations when you need derived values such as deposits, tax, or due dates.
Use Adding Tables (Like Products or Contacts) to Your Document when you need child records or table output.
Build an invoice template with template attributes
What you'll configure
Basic merge field structure
format-datefor invoice dateformat-numberfor currency valuescheckboxfor payment optionsToUpperCasefor 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
OpportunityA 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.
Step 1: Open or create the template
Start with an Opportunity template that will generate an invoice.
Go to S-Docs Templates in Salesforce.
Open an existing template or click New Template.
Set Related To Type to
Opportunity.Set Template Format to
PDF.Open the template editor.
You now have a place to add template attributes in the document body.
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 fieldOpportunity.CloseDatepoints to one field on the base recordAttributes come after the field path
}}closes the merge field
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-datetoOpportunity.CloseDateUsed
MMMM d, yyyyfor month name, day, and four-digit yearCreated 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
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-numberto the amount fieldAdded 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
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
trueorfalseKept the labels readable for the final document
Used a pattern you can swap to
checkbox="black"orcheckbox="radio"later
Merge field rule:
Put the label outside the merge field
Keep the
checkboxattribute inside the same field
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
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
Step 8: Save and test the template
Generate the invoice from a real Opportunity before adding variations.
Click Save in the template editor.
Open a test Opportunity with the fields you used.
Generate the template.
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
yyyyfor the year informat-datepatterns.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
checkboxonly with boolean fields.Expect checkbox rendering to work best in PDF templates.
If you apply
checkboxto 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?

