Merge Fields

by Community Manager on ‎08-13-2015 02:19 PM - edited on ‎11-07-2016 01:56 PM by Community Manager


SteelBrick CPQ Quote Templates allow you to create mail-merge like documents that dynamically populate your Quote data on the fly. You can set up placeholders for this data, called Merge Fields, in your Quote Template, and generate a PDF Document using the layout and merge fields in your Quote Template.



Using Merge Fields in Templates

Before you begin, create the fields you want to reference and populate them with the data on each Quote you want dynamically replaced with the merge fields in your quote template. Take special note of the type of field you plan to reference as a merge field. Lookup fields require a few additional steps as they simply reference another record with a 15-character Salesforce ID of that record.


Referencing Merge Fields from your Template Content

  1. Navigate to the Template Content that you want to contain your Merge Field and click Edit.
  2. Within the Markup section, Insert a Merge Field using the following format: {!quote.SBQQ__FieldName__c} and replace "quote" with the object on which the field was created.
    • "SBQQ__" is the namespace prefix for the SteelBrick managed package components so it only needs to be included when referencing SteelBrick fields.
    • Do not include "SBQQ__" in any merge fields referencing custom Quote Fields that you created after installing SteelBrick.
    • Finally, replace "NameField__c" with the API Name of your custom field.

Note: Your custom number, percent, currency, or text fields are formatted for their respective data types. But your custom lookup fields simply store the 15-character Salesforce ID of the record selected. To reference the selected records name or number, build a custom formula field to store that on the quote and reference the formula field in your merge field instead.



merge fields.png


In the example Template Content above, several different types of merge fields are used aS explained below:

Merge Field Description
{!quote.SBQQ__BillingName__c} Exists on the Quote object and includes the "SBQQ__" prefix to the "BillingName__c" API name since it's an installed field with the SteelBrick package.
{!template.SBQQ__ShipToTitle__c} Exists on the Quote Template object so it begins with "{!template." and it comes installed in the SteelBrick managed package so it also includes the "SBQQ__" prefix to the field API name "ShipToTitle__c".
{!primaryContact.Name} References the primaryContact lookup to the Contact object initially because it is a lookup field on the Quote. It does not reference the "SBQQ__" prefix because Contract is a standard object in Salesforce. Although this is a lookup field, you don't need to build a formula field to reference the contact's name because this comes built in with SteelBrick's installed components.
{!salesRep.Name} Like, primaryContact.Name, salesRep.Name is a lookup field on the Quote object that comes installed in the package so it needs no "SBQQ__" prefix.
{!quote.Type_of_Transaction__c} Is a custom picklist field created after installing SteelBrick. Since it exists on the Quote object, it begins by referencing the object: "{!quote." and continues with the API Name of the custom field "Type_of_Transaction__c}" but needs no "SBQQ__" prefix.



Your custom number, percent, currency, text and etc. Merge Fields will be formatted for their data type. However, lookup fields simply reference the 15-character Salesforce ID of the record selected. To reference the selected records name or number, build a custom formula field to store on the Quote and reference the formula field in your Merge Field instead.



For example, if you built a custom lookup field on the Quote object called "Shipping Contact," a Merge Field would simply display the Salesforce ID for the contact selected. To display the contact's name, build a formula field that traverses the lookup and displays the shipping contact's name.


Creating a formula field that references your lookup

    1. Navigate to Setup | Create | Objects | Quote.
    2. Click New in the Custom Fields & Relationships list.
    3. Select Formula as the Data Type
    4. Click Next.
    5. Enter a meaningful name for this field (e.g. Shipping Contact Name).
    6. Select the appropriate data type (e.g. Text).
    7. Click Next .
    8. Click Insert Field to traverse the Shipping Contact lookup to its related fields such as Name.


    1. Click Insert. Your formula should resemble the image below:


    1. Check syntax to make sure it contains the correct data formatting functions, click Next, and continue with creating the formula field.
    2. Reference the formula field in your template content as shown in the highlighted box below:merge2.png




If your merge field syntax is correct yet the generated PDF document is not displaying the data or is displaying an error, click the HTML button highlighted below in your template content toolbar to troubleshoot.

Ensure your merge field name was pasted in correctly. Formatting tags can get inserted within the brackets when pasted in from a rich text applications.

  • Instead, paste from Notepad, which strips out all excess formatting.
  • Alternatively, click the HTML button on the template content editing toolbar and remove formatting tags manually, making sure that the merge field syntax is not interrupted by these tags.

Tip: Merge Fields are used for data, not metadata. Best Practice for translating standard Salesforce fields into foreign Quote Templates is to clone your template and translate the column headers and text in Template Content records (which also needs to be translated).

by Scooby6995
on ‎08-28-2017 11:22 AM

Can I add today's date to a template?

by Jknott
‎11-08-2017 01:20 PM - edited ‎11-08-2017 01:21 PM

@Scooby6995 Depends on the case you are trying to address. I created a formula field on the Quote that shows Today's date. Then I used it as my merge field on the Quote Template, in a template content/section of choice. Let me know if this helps. 

Tuesday - last edited Tuesday

This article should mention which objects are allowed to be referenced in HTML Template Contents.  Or at least link to here where it lists them.  Listed below for convenience.  Robot Very Happy










Not Allowed: