Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Rearrange the Line Item Table

Learning Objectives

After completing this unit, you’ll be able to:

  • Separate quote lines into two or more line item tables.
  • Create subgroups within line item tables that include subtotals.
  • Determine which totals and subtotals appear under line item tables.
  • Show or hide quote lines in the line item table based on various criteria.

Gotta Keep ’Em Separated

When you preview your proposal with Q-00053, you find that all of the line items are placed into a single table, which is usually just fine. But some businesses prefer to split quote lines into separate tables to make the quote easier to parse, and to show subtotals of related products. With Salesforce CPQ, you can group line items by just about any criteria you can imagine.

In order to group line items, you just need to tell CPQ which quote line text field to group by. Then, it makes a group for every unique value it finds. Let’s see how this works by making a text formula field that separates subscription products from non-subscription products. You start by navigating to Setup.

  1. Click Setup icon and click Setup. The Setup page opens in a new tab.
  2. Click Object Manager.
  3. Click Quote Line.
  4. Click Fields & Relationships.
  5. Click New.
  6. Choose Formula.
  7. Click Next.
  8. For Field Label, enter Purchase Type.
    In real life the name of the field doesn’t matter, just remember it for later.
  9. Choose Text.
  10. Click Next.
  11. For Formula, enter IF(ISPICKVAL(SBQQ__SubscriptionPricing__c, ""),"One-time Purchases","Subscriptions").
    This formula checks if the Subscription Pricing field is blank, meaning the product must be a one-time purchase. Otherwise it’s a subscription.
  12. Click Next.
  13. Click Next to keep field level security as is.
  14. Click Save.

Before you can tell CPQ to use the Purchase Type field in your quote template, you have to add the API name of the field to the Group Field picklist.

  1. Click Object Manager.
  2. Click Quote Template.
  3. Click Fields & Relationships.
  4. Click Group Field.
  5. In the Values section, click New.
  6. Enter Purchase_Type__c.
    This is the API name of the Purchase Type formula field.
  7. Click Save.

You can close the Setup tab, you’re ready to update your quote template and give it a little style at the same time.

  1. In the navigation bar, click Quote Templates.
  2. Click AW Proposal.
  3. Click Edit.
  4. For Group Shading Color, enter F5F5F5.
  5. For Group Font Size, enter 12.
  6. For Group Field, choose Purchase_Type__c.
  7. Click Save.

Great, now CPQ knows to use the custom field to distinguish one quote line from another. If you preview the proposal with Q-00053, you get tables that look like this.

Portion of proposal showing two tables.

Grouping line items with the Group Field is pretty neat, but there are a few caveats to be aware of.

  • Bundled products can be separated into different groups.
  • If your sales reps use Quote Line Groups in the Quote Line Editor, CPQ always uses their grouping regardless of what the Group Field is set to.
  • There’s a Group Field on the template section record that takes precedence over the quote template version.

Groups Within Groups

If you like grouping line items, you’re going to love subgrouping. It adds an extra layer of grouping based on another quote-line field. Subgrouping takes two steps to set up. The first is to identify the field to subgroup by. Let’s choose Product Family.

  1. While on the AW Proposal quote template record, click Edit.
  2. For Sub Group Field, choose Product Family.
    This is an out-of-the-box value that uses the product family that originates from the product record.
  3. Click Save.

Good, you’re halfway there. The second step is to tell CPQ to sum the values of at least one line column. The Customer Price column is perfect for that.

  1. Click the Related tab.
  2. In the Line Columns related list, click View All.
  3. For the CUSTOMER TOTAL record, click Edit from the menu.
  4. For Summary Level, choose Sub Group.
    This shows a subtotal row only for each sub group. If you choose All for Summary Level, an extra row is added to the bottom for the whole group, which you don’t need since each group already shows a subtotal.
  5. For Summary Function, choose SUM.
  6. Click Save.
    Let’s also sum the Partner Price column.
  7. For the PARTNER PRICE record, click Edit from the menu.
  8. For Summary Level, choose Sub Group.
  9. For Summary Function, choose SUM.
  10. Click Save.
    Without doing anything more, sums for Customer Total and Partner Price will appear in summary rows. But to make it more clear what the values mean, let’s add labels into the PRODUCT column.
  11. For the PRODUCT line column record, click Edit from the menu.
  12. For Summary Level, choose Sub Group.
  13. For Sub Group Summary Label, enter {0} Subtotal.
    The {0} is a placeholder that is replaced with whatever product family the line item belongs to. For example, “Hardware.”
  14. Click Save.

Now when you preview Q-00053 you find new rows separating line items within a group, each with labels and a product family total.

Portion of proposal showing a line item table group with subgroup totals.

By the way, if you’re doing the math you may notice that the subtotals amount to more than the total at the bottom of the table. That’s because the 10” Tablet is an Optional item, which doesn’t contribute to totals at the bottom of the table. Later you learn how to hide Optional items.

Total Control of Totals

By default, the tables in your proposal have a total displaying in the lower right. There are a number of ways to change what appears under the table, and after all tables. Here are the fields that can affect totals, where to find them, and what they do.

Portion of quote document showing the end of a table and overall quote totals.

Field Name
(Location)
Affect on Totals

Print Quote Totals
(template section)

When checked and lines are grouped, displays overall quote totals after group tables. [1]

Subtotal Field
(quote template)

Adds your choice of either List, Regular, Customer, or Net Price subtotals [2][3].

Show Customer Discount &
Customer Discount Field
(quote template)

When checked, adds the value of the selected Customer Discount Field [4][5]. If that field is blank, List minus Customer amount is displayed. When using a custom field be sure it exists at both the quote and quote line level, otherwise one of the customer discount totals will not appear.

Show Partner Discount
(quote template)

When checked, adds the calculated amount of Partner Discount [6][7].

Total Field
(quote template)

Displays your choice of either List, Customer, or Net Price subtotals [8][9]. Displays List Price if blank.

Hide Group Subtotals
(quote template)

When checked and lines are ungrouped, hides subtotal [2]. When checked and lines are grouped, hides subtotal [2] and total [8].

Hide Totals
(quote template)

When checked and lines are ungrouped, hides total [8].

Summary Display
(template section)

“Always” will show subtotal [2] and total [8] regardless of Hide Group Subtotals or Hide Totals values, but doesn’t force display of discounts [4][6]. “Never” will remove all subtotals [2][4][6][8] from tables regardless of other field values.

Hide Line Items Using Basic Controls

Although we love all quote lines equally, some are just not as important as others. Often, businesses want to hide certain lines to keep the focus on others. There are a few fields that quickly determine if a quote line is included in the proposal.

Field Name
(Location)
Affect on Line Visibility

Hide Component Products
(quote template)

When checked, removes any product that’s an option for a bundle. By default they are shown.

Show Bundled Products
(quote template)

When checked, options that are marked as “Bundled” will appear. By default they are left out.

Show All Package Products
(quote template)

When checked, zero-value “virtual bundle” parents will appear. By default they are left out.

Quote Line Visibility
(product option)

When set to “Never” or “Editor Only” the line for the option is removed.

Show Renewed Products
(quote template)

When checked, non-subscription parent and siblings of a renewed subscription will appear on a renewal quote. By default they are left out. The results are affected by Show Bundled Products and Show All Package Products.

Be aware, any lines hidden by Hide Component Products and Quote Line Visibility still contribute to the values shown in quote totals. If you use either of these, consider changing price-related line columns to use Package List Total and Package Total fields, which display the sum of the options and parent prices.

Hide Line Items Using Filtering

The premade checkboxes for hiding bundle- and renewal- related lines are nice, but quite limited. Thankfully there’s a sophisticated way of hiding lines based on any criteria you want. For example, let's say you don’t want to show quote lines if they are marked as Optional. Optional lines are meant to identify potential upsells, and don’t contribute to the quote total. You start by navigating to the template section for the line item content.

  1. In the navigation bar, click Quote Templates.
  2. Click AW Proposal.
  3. Click the Related tab.
  4. In the Sections related list, for the Line Items record, click Edit from the menu.
  5. For Filter Field, choose Optional.
    This points to the out-of-the-box Optional quote-line field. You can add your own custom field if necessary.
  6. For Filter Operator, choose equals.
  7. For Filter Value, enter false.
    This tells CPQ to only show lines that are not checked as optional.
  8. Click Save.

For Q-00053, the Tablet product was marked as optional, so it is now gone from the line item table.

Portion of proposal with line item table, the tablet product is missing.

Be aware, filtering products this way does not remove their value from quote totals. That’s OK for optional products since they never contribute value anyhow, but it’s possible to filter lines that do. If you filter out lines that have value, you may want to create a separate line item table that shows only those products you filtered so that the customer knows where the total quote value is coming from.

Phew, this was a long unit, but you did well! Now it’s time to check out other ways to add to your quote template, starting with custom Visualforce content.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback