📢 Attention Salesforce Certified Trailblazers! Maintain your credentials and link your Trailhead and Webassessor accounts by April 19th. Learn more.
close

Create a Validation Product Rule Using a Summary Variable

Introduction

Validation Rules are a lot like Alert Rules; they both show messages when something is amiss. The difference is that while Alerts allow sales reps to bypass the message, Validations completely stop them from saving—preventing the creation of invalid quotes. Also, Validation messages appear in red at the top of the page.

Quote Line Editor with validation error message

Create a Summary Variable to Sum Home Security Consoles

AW Computing has a policy that sales reps can add only one Home Security Console bundle to a given quote. Sometimes sales reps try to sell two, and we need to stop that from happening.

This rule checks to see if there are multiple Home Security Console bundles on the quote, which means we need to know how many exist as quote lines. To find out how many exist we must create a Summary Variable. Generally speaking, a Summary Variable represents a number that is found by aggregating many records. For example, we can look at our quote line records and aggregate the quantities of any Home Security Console product. Let’s set up a Summary Variable to do just that.

  1. Click Summary Variables from the navigation bar.
  2. Click New.
  3. In the Variable Name field, enter Sum of Quantity for Home Security Console Quote Lines.
  4. For the Aggregate Function field, choose Sum.
  5. For the Aggregate Field field, choose Quantity.
  6. For the Target Object field, choose Quote Line.
  7. For the Filter Field field, choose Product Code.
  8. For the Operator field, choose equals.
  9. In the Filter Value field, enter HOMESECURITYCONSOLE.
  10. Click Save.

Great, your Summary Variable adds together quantities of any quote lines where the Product Code is HOMESECURITYCONSOLE. You use this Summary Variable when you create the Error Condition later.

Create a Validation Product Rule to Limit Home Security Consoles

Your Validation Product Rule will be similar to your Alert rule in that it will have a message that appears if something is amiss when the sales rep clicks Save. However, there is one important distinction. This rule must work while the sales rep is in the Quote Line Editor so that Salesforce can evaluate everything on the quote, not just what’s in a specific bundle. This means we have to broaden the scope of the rule.

  1. Click Product Rules from the navigation bar.
  2. Click New.
  3. In the Product Rule Name field, enter Prevent Duplicate Bundles.
  4. For the Type field, choose Validation.
    The Scope field remains as Quote, since you need the rule to run on the quote in general, not within a specific bundle.
  5. For the Evaluation Event field, choose Save.
  6. Check Active.
  7. For the Conditions Met field, choose All.
  8. In the Message field, enter You may only have one Home Security Console on this quote, please delete all but one.
  9. Click Save.

Create an Error Condition to Leverage a Summary Variable

The final piece of the puzzle is to make an Error Condition that controls when the rule fires. You need it to fire if there is more than one Home Security Consoles on the quote. Thankfully we can use our Summary Variable from earlier to see if this is true.

  1. In the Error Conditions related list, click New.
  2. In the Tested Variable field, search for and select Sum of Quantity for Home Security Console Quote Lines.
  3. For the Operator field, choose greater than.
  4. For the Filter Type field, choose Value.
  5. In the Filter Value field, enter 1.
  6. Click Save.

Excellent, your rule is done! Any time the sales rep clicks Save, CPQ adds up the number of Home Security Consoles on the quote, and throws an error message if the value is more than 1.

Test the Home Security Console Validation Rule

Again, you pretend to be a sales rep to perform two tests, one where a quote has a single Home Security Console, and another where you intentionally add two.

  1. Click Accounts in the navigation bar.
  2. Click The Fernando Estate.
  3. Click the Related tab.
  4. From the Quotes related list, click Q-00012.
  5. Click Edit Lines.
  6. Click Add Products.
  7. Check the box next to the Home Security Console product.
  8. Click Select.
  9. Update the quantity of the Window Sensor option to 2.
  10. Click Save.
  11. Click Quick Save.
    Your quote should save like normal.
  12. Click the Clone Line button for the Home Security Console.
    Quote Line Editor
  13. Click Quick Save.
    An error message should appear at the top of the Quote Line Editor.
    Quote Line Editor with error message

Fantastic, your sales reps can no longer sell more than one Home Security Console per quote. No more returned or rejected quotes due to this little mistake.

Summary

Bundles and Product Rules in Salesforce CPQ are some of the best tools to help your sales team quote more accurately and quickly. They don’t need to memorize how new and complicated products must be sold together. Instead, they can rely on the guidance you build and maintain with relatively few clicks.

Resources

retargeting