Advanced Data: Formula Builder
Formula variables allow you to evaluate complex logic, perform calculations, and render dynamic values directly within your document templates using standard Salesforce operators and functions.
Before You Begin
Open your target document template inside the S-Docs template builder.
Creating a Formula Variable


Navigate to the main variables panel and select the Advanced Variables
icon located at the top of the panel.In the right-side drawer, select Formulas.
Select Click to add under the Formulas section to launch the configuration panel.
Enter a custom name for your variable in the Label field.
Select a data type from the Return Type dropdown menu. String is selected by default. Available options include:
String
Checkbox
Currency
Date
Date Time
Decimal
Integer
Percent
Time
Click Configure Formula to open the formula builder.

Build your expression using standard object fields, operators, and functions:
Click Insert Field to search or select fields from the current object record.
Select standard Salesforce operators from the Operators dropdown menu.
Choose functions from categories including math, text, date and time, logical, and advanced.
Select Validate to verify your formula syntax is correct.
Formulas can not be saved if the syntax is invalid.
Click Confirm once the formula is validated.
Click Add Formula in the configuration panel to save the item to your library.
Inserting a Formula Variable Into a Template
Once created, formula variables appear in the main variables panel under the Formulas category. They are grouped by their assigned return type — such as text, date, or time — and function identically to standard variables.
Open the main variables panel
and navigate to the Formulas category.Select and insert your formula variable into the template body.
Last updated
Was this helpful?

