Loading
Quote Creation Issue - Non-USD CurrenciesRead More
Important Advisory: iOS Update Impacting CG Mobile ApplicationRead More

In Salesforce CPQ (Managed Package) - Group and Sort Quote Documents with Quote Templates

Publish Date: Jun 30, 2026
Description

The Group Field on the Quote Template can be used to group your quote lines by a field you specify. The default is not to group the quote lines. Without further set up, you can select Product Family as the way to group the quote lines. You can also add the API name of any Quote Line field to force grouping by that field. The default behavior is that the lines in this grouping are sorted based on the order in which the lines were added to the Quote. Further customization is possible to sort this group in other ways.

Salesforce CPQ Quote Templates include a Group Field that can be used to group Quote Lines by a specified field.

By default, Quote Lines are not grouped. Without additional setup, users can select Product Family as the grouping option. Users can also add the API name of a Quote Line field to group Quote Lines by that field.

When Quote Lines are grouped, the default sorting behavior is based on the order in which the lines were added to the Quote. Additional customization can be configured to group and display Quote Lines in other ways.

Resolution

The default Quote Template grouping behavior uses the selected Group Field value to group Quote Lines. However, when custom grouping logic or custom display labels are required, Salesforce CPQ needs a related field naming convention to identify both the internal grouping value and the label displayed on the generated Quote Document.

To customize grouping and display labels in Salesforce CPQ Quote Documents, create two fields on the Quote Line object. The API names of these fields must be linked by a specific naming convention.

For example, if the grouping field API name is:  GroupName__c

Create a second field with the API name: GroupNameLabel__c

The label field is created by adding Label at the end of the first field name, before '__c'.

Example: Group by Bundle Name

For this use case, the grouping should return the bundle name. If multiple bundles can return the same name, create two fields on the Quote Line object:

  • One field returns the internal group value with a unique value per bundle.
  • The other field returns the label to display on the Quote Document.

Create a formula field called BundleName with API name BundleName__c:

CASE( SBQQ__OptionLevel__c ,
  2 , LPAD( TEXT( SBQQ__RequiredBy__r.SBQQ__RequiredBy__r.SBQQ__Number__c ) , 10 , "0" ) ,
  1 , LPAD( TEXT( SBQQ__RequiredBy__r.SBQQ__Number__c ) , 10 , "0" ) ,
  LPAD( TEXT( SBQQ__Number__c ) , 10 , "0" )
)


Create a formula field called BundleNameLabel with API name BundleNameLabel__c:

CASE( SBQQ__OptionLevel__c ,
  2 , SBQQ__RequiredBy__r.SBQQ__RequiredBy__r.SBQQ__ProductName__c ,
  1 , SBQQ__RequiredBy__r.SBQQ__ProductName__c ,
  SBQQ__ProductName__c
)

After creating these fields, add BundleName__c to the picklist values for the Group Field field on the Quote Template. Then select BundleName__c as the Group Field on the Quote Template.

Salesforce CPQ uses BundleName__c as the internal grouping value and BundleNameLabel__c as the display label for the group in the generated Quote Document.


Knowledge Article Number

000383954

 
Loading
Salesforce Help | Article