Skip to main content

Filter Discount Schedules by Records and Fields

Learning Objectives

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

  • Set limits for which records are counted in discount schedule sums.
  • Describe how to use a non quantity field to determine the correct discount tier.


As you saw in the last unit, Salesforce CPQ can aggregate quantities from multiple records across orders to determine the right discount tier to use for a discount schedule. However, there are times when we don’t want every single record to count toward the total quantity. For example, a cross order schedule tells CPQ to aggregate every asset that exists on the account, but AW Computing wants only those assets purchased in the last 365 days to count. With a little work it is possible to filter which asset records are included in the aggregated sum.

Distinguish Old and New Assets

The first step in filtering records is to distinguish which assets have been purchased in the last 365 days. In this example, AW Computing has diligently maintained an asset field named Purchase Date over the years. You use this information to create a custom formula checkbox field named Purchased This Year, which returns “True” when the Purchase Date is less than 365 days from today’s date.

  1. Click Setup icon and click Setup. The Setup page opens in a new tab.
  2. Click Object Manager.
  3. Click Asset.
  4. Click Fields & Relationships.
  5. Click New.
    Your new field is going to be a Formula field since it automatically works out the age of the asset.
  6. Choose Formula, then click Next.
  7. For the Field Label, enter Purchased This Year.
  8. Choose Checkbox as the Formula Return Type, then click Next.
    Here we see the formula editor, which is used to determine how the field gets its value. We need a formula that checks if it’s been 365 days since the purchase date.
  9. Type or paste this into the formula window: TODAY() - PurchaseDate < 365
  10. Click Next.
  11. Click Next to keep field-level security as is.
  12. Click Save.

Now every asset purchased in the last 365 days will have the custom field named Purchased This Year automatically checked, while assets older than a year will be unchecked. Now that asset records are separated into two distinct groups, it is much easier to filter which are included in aggregate quantities.

Create an Answer Key

At this point, we humans know that when Purchased This Year is checked the asset should be included in the aggregated sum, but CPQ doesn’t know that yet. Our next challenge is to put what we know into a format that CPQ can understand. We do so by making an answer key that contains the correct answer for the question: “Which value of Purchased This Year means we should include the asset in aggregation?”

The answer key takes the form of a custom field on the quote object. You create a text formula field that always returns the word “True” since that is the correct answer to our question posed above.

  1. While in the Setup tab, click Object Manager.
  2. Click Quote.
  3. Click Fields & Relationships.
  4. Click New.
  5. Choose Formula, then click Next.
    The name of our answer key field is very important. It must be the same as the asset field containing the answers we’re checking against. In other words, using the same field name links the answer key to the answers.
  6. For the Field Label, enter Purchased This Year.
  7. Choose Text, then click Next.
    The formula may be one of the simplest formulas you’ve ever written: It’s just the answer to the question “Which value of Purchased This Year means we should include the asset in aggregation?”
  8. Enter "true" (including inch marks) into the formula window.
  9. Click Next.
  10. Click Next to keep field-level security as is.
  11. Click Save.

Update Discount Schedule Constraint Field

So far, so good. In the first step, you created a field that distinguishes new assets from old. In the second step, you made an answer key that identifies which assets should be included in aggregate sums. The final step is to update the Bulk Keys discount schedule to use the answer key as a way of filtering asset records by their Purchased This Year value.

  1. While in the Setup tab, click Object Manager.
  2. Click Discount Schedule.
  3. Click Fields & Relationships.
  4. Click Constraint Field.
  5. In the Values list, click New.
  6. Type or paste Purchased_This_Year__c into the picklist values window.
    Picklist values input box
    It’s extremely important to use the exact API name of the Purchased This Year field, because CPQ throws an error message in the Quote Line Editor if it can’t find the field it’s looking for.
  7. Click Save.
    Close the Setup browser tab to return to the Salesforce CPQ app.
  8. Click Discount Schedule from the navigation bar.
  9. Click Bulk Keys.
  10. Click Edit.
  11. Check the Cross Orders checkbox.
  12. For the Constraint Field, choose Purchased_This_Year__c.
  13. Click Save.

By setting the Constraint Field to Purchased_This_Year__c, you’ve told CPQ which answer key to use when determining the assets to include when aggregating quantities. Now only assets purchased within the last year count toward the discount tier quantity.

Test Your Work

You can see if only new assets are included in the discount schedule by adding RFID key cards to a quote for University of Arizona, a customer who has purchased key cards two times in the past.

  1. Click Accounts from the navigation bar, then choose the All Accounts list view.
  2. Click University of Arizona.
  3. Click the Related tab.
    If you scroll to the Assets related list, you can see that there are two RFID Key Card assets, but only 50 were purchased within the last year. The older 80 key cards shouldn’t be counted toward the discount schedule.
  4. Click Q-00020 from the Quote related list.
  5. Click Edit Lines.
  6. Click Add Products.
  7. Check the box for the RFID Key Card.
  8. Click Select.
    Once the Quote Line Editor loads, you should see that the key card is still full price at $1.00, meaning that the old key cards aren’t being counted.
  9. Change the quantity to 50, then click Calculate.
    Now the 50 key cards from this quote line and the 50 from key cards purchased a few weeks ago are combined, which qualifies for the 10% discount.
  10. Click Save.

Excellent, you now know that only key cards purchased within the last year count toward the discount schedule tier. For this example, we used Purchase Date to drive the formula field that distinguishes one group of assets from another, but you can use any information on the asset record, making the Discount Schedule Constraint Field quite a versatile tool.

Quote Line Quantity Field

By default, Salesforce CPQ uses the Quantity field on the quote line to determine which discount tier to use. This works well in most cases, but there are times when you don’t actually want to use the quote line quantity.

Imagine this scenario: AW Computing wants to give a discount on RFID Key Cards, but it wants to base the discount on how many door locks are sold, not how many key cards are sold. For example, if the customer buys more than 30 door locks, they get a 5% discount on key cards. In this case, the quantity of key cards is irrelevant.

Salesforce CPQ supports this scenario with just a little setup.

  • First, you create a custom numeric field on the Quote Line object. You can call it Total_Locks__c.
  • Second, you update the value of Total_Locks__c for every RFID Key Card quote line record. (A price rule works nicely here, but that is beyond the scope of this module).
  • Third, you update the Bulk Keys Discount Schedule to choose Total_Locks__c for the Quote Line Quantity Field picklist (after adding Total_Locks__c as a picklist value).
    Discount Schedule record

Discount schedules using the Quote Line Quantity field do not support cross order functionality to aggregate quantities from asset records.

While it takes some work to set up the Quote Line Quantity Field field, the effort allows you to support special cases where the Quantity field isn’t the right fit. Now that we have explored how to control what quantities are included in discount schedules, let’s look at some advanced ways to affect volume-based pricing.


  • 各自のキャリア目標に合わせてパーソナライズされたおすすめが表示される
  • ハンズオン Challenge やテストでスキルを練習できる
  • 進捗状況を追跡して上司と共有できる
  • メンターやキャリアチャンスと繋がることができる