Salesforce CPQ: Creating Product Validation Rules

  • Blog
  • Salesforce CPQ: Creating Product Validation Rules
blog image
15
Nov

Let's imagine a typical situation when the sales representative must sell a bundle in which there are at least as many Product B's as Product A's. You need to create a validation rule that will prevent the sales rep from saving the ProductPack1 when they have an insufficient number of Product B's for the number of Product A's:

Step 1: Create a Summary Variable to determine the aggregated quantity of Product A in a configuration.

  1. A. Click the Summary Variables tab from the navigation bar.
  2. B. Click New.
    1. ► In the Variable Name field enter a meaningful name: Total quantity of PRODUCTA
    2. ► For the Target Object, select Product Option
    3. ► For the Aggregate Function, select Sum
    4. ► For the Aggregate Field, select Quantity
    5. ► For the Filter Field, select Product Code
    6. ► For the Operator, select equals
    7. ► In the Filter Value field, enter PRODUCTA
  3. C. Click Save.

Repeat the same step for Product B:

Step 2: Create a Summary Variable to determine the aggregated quantity of Product B in a configuration.

  1. A. Click the Summary Variables tab from the navigation bar.
  2. B. Click New.
    1. ► In the Variable Name field enter a meaningful name: Total quantity of PRODUCTB
    2. ► For the Target Object, select Product Option
    3. ► For the Aggregate Function, select Sum
    4. ► For the Aggregate Field, select Quantity
    5. ► For the Filter Field, select Product Code
    6. ► For the Operator, select equals
    7. ► In the Filter Value field, enter PRODUCTB
  3. C. Click Save.

Step 3: Create a Product Rule that confirms how the validation rule will function during product configuration.

  1. A. Click the Product Rules tab from the navigation bar.
  2. B. Click New.
    1. ► In the Product Rule Name field enter a meaningful name: Product B quantity must be greater than or equal to Product A quantity
    2. ► For the Type, select Validation
    3. ► For the Scope, select Product
    4. ► For the Evaluation Event, select Save (This tells Salesforce that the rule must be evaluated upon Save)
    5. ► CheckActive
    6. ► For the Conditions Met, select All
    7. ► For the Message, enter: Product B quantity must be greater than or equal to Product A quantity!
  3. C. Click Save.

Step 4: Create an Error Condition that controls when the rule fires, that is only when Product B Summary Variable is less than Product A Summary Variable.

  1. A. Click the Related tab from the navigation bar.
  2. B. Click Newin the Error Conditions related list.
    1. ► Tested Variable: Total quantity of Product B
    2. ► Operator: less than
    3. ► For the Scope, select Filter Type: Variable
    4. ► Filter Value: Total quantity of Product A
  3. C. Click Save.

Step 5: Create a Configuration Rule to show that the validation rule will apply to the ProductPack1 bundle.

  1. A. In the Configuration Rules related list, click New.
    1. ► Check Active
    2. ► For the Product, select ProductPack1
  2. B. Click Save.

Step 6: Check whether the rule behaves as expected by adding ProductPack1 to a quote.

  1. A. Click the necessary quote.
  2. B. Click Edit Lines.
  3. C. Click Add Products.
  4. D. Check the ProductPack1 product.
  5. E. Click Select.
  6. F. Check the Product A option.
    1.  (Pay attention to the fact that Product B and Product C options are automatically selected). 
  7. G. Change Product A quantity to 2.
    1.  (Meanwhile, the quantity of Product B is 1.) 
  8. H. Click Save.
    1.  (Pay attention to the error message that appears in red at the top of the page.) 
  9. I. Change Product B quantity to 2.
    1.  (Select the option if necessary.) 
  10. J. Click Save.
    1. (The configuration should save as normal.)

This way, if the quote isn't configured properly, the quote line editor will show an error message when the user attempts to save it.

Comments (0)

Leave a Comment