14
FebSalesforce CPQ: Creating Price Rules - Scenario 2
Suppose your clients want their users to sell ProductY and ProductW but they want to make sure that 1 ProductY is included for every 5 ProductW, and those quantities are always an integer value. This means we'll have to create a price rule that calculates the quantity of ProductY based on how many ProductW the user adds to the quote.
Step 1. First, create a Summary Variable to represent one fifth of the quantity of ProductW across all quote lines.
- A. Click the Summary Variables tab from the navigation bar.
- B. Click New.
- ►For the Variable Name field, enter a meaningful name that would make sense for you and your colleagues, for example:Total quantity of ProductW divided by 5
- ►For the Target Object field, select Quote Line
- ►For the Aggregate Function field, select Sum
- ►For the Aggregate Field, select Quantity
- ►For the Filter Field, select Product Code
- ►For the Operator field, select equals
- ►For the Filter Value field, enter ProductW
- ►For the Composite Operator field, select Divide
- ►For the Value Element, enter 5
- C. Click Save.
Step 2. Create a Price Rule that will specify that it will be evaluated on the Quote Line Editor and for calculation events.
- A. Click the Price Rules tab from the navigation bar.
- B. Click New.
- ►For the Price Rule Name field, enter Set quantity of ProductY based on the quantity of ProductW
- ►For the Evaluation Scope field, select Calculator
- ►For the Evaluation Order field, enter 20
- ►Check the Active checkbox
- C. Click Save.
Step 3. Create a Price Condition that makes the rule evaluate only when the quote line product code is ProductY.
A. Click New in the Price Condition related list and set the field values:
- ►For the Object field, select Quote Line
- ►For the Field, select Product Code
- ►For the Operator field, select equals
- ►For the Filter Type field, select Value
- ►For the Filter Value, enter ProductY
B. Click Save.
Step 4. Create the first Price Action that will set the quote line Quantity field to the value of the composite summary variable and set it to run first.
- A. Click New in the Price Actions related list and set the following field values:
- ►For the Target Object field, select Quote Line
- ►For the Target Field, enter SBQQ__Quantity__c
- ►For the Source Variable field, enter Total quantity of ProductW divided by 5
- ►For the Order field, enter 1
- B. Click Save.
Step 5. Create the second Price Action that will set the quote line Quantity field to a rounded version of its own value and set it to run second.
- A. Click New in the Price Actions related list and set the following field values:
- ►For the Target Object field, select Quote Line
- ►For the Target Field, enter SBQQ__Quantity__c
- ►For the Formula field, enter CEILING (SBQQ__Quantity__c)
- (Note: The CEILING function rounds a number up to the nearest integer. There is also the FLOOR function which rounds down a number to its nearest integer.)
- ►For the Order field, enter 2
- B. Click Save.
Step 6. Verify rule behaves as expected by adding ProductY and ProductW to a quote.
- A. Click the necessary quote.
- B. Click Edit Lines.
- C. Click Add Products.
- D. Check ProductY and ProductW.
- E. Click Select.
- E. Set the quantity of ProductW to 10.
- E. Click Calculate.
- (Note the quantity of ProductY is now 2.)
This is another example of how you can make sure that the correct number of any product is sold depending on the quantity of other products.
Comments (1)
Brendan
Dec 6, 2022Super helpful! Thank you