Generally Product rules are made in Salesforce CPQ to evaluate product options within a bundle, or a quote, or a quote line against some conditions (Error Condition) and if conditions are fulfilled as per Client requirement then perform ‘Actions’ in that response.These Rules are very useful in enforcing business logic during configuration and in giving feedback to Sales reps regarding product selection.
Scenario: Create a Validation Product Rule to Limit the Number of Warranty Product should be Equal to Number of Hardware Product (in our Case CARS, Keys,Toolkits are hardware product in our Bundle)
Step 1: Create a Summary Variable to get Sum of “Hardware (Tata Cars)”
- Click Summary Variables from the navigation bar.
- Click New.
- In the Variable Name field, enter
Sum of Hardware (Tata Cars).
- For the Aggregate Function field, choose
Sum.
- For the Aggregate Field field, choose Quantity.
- For the Target Object field, choose Product Option.
- For the Filter Field field, choose Product Code.
- For the Operator field, choose equals.
- In the Filter Value field, enter HARDWARE (We have given Product Code as HARDWARE for Hardware Products
- Click Save.
Step 2:Create a another Summary Variable to get Sum of Warranty
- Click Summary Variablesfrom the navigation bar.
- ClickNew.
- In the Variable Name field, enterSum of Warranty (Tata Cars).
- For the Aggregate Function field, chooseSum.
- For the Aggregate Field field, chooseQuantity.
- For the Target Object field, choose Product Option.
- For the Filter Field field, choose Product Code.
- For the Operator field, choose Contains.
- In the Filter Value field, enter WARRANTY.
- Click Save.
Step 3: Create a Validation Product Rule
- Click Product Rules from the Navigation bar.
- Click New.
- In the Product Rule Name field, enter Warranty Sum should be Equal to Sum of Hardware Product.
- For the Type field, chooseValidation.
- The Scope field remains asQuote,since you need the rule to run on the quote in general, not within a specific bundle.
- For the Evaluation Eventfieldchoose Save
- Check Active
- For the Conditions Met field, chooseAll
- In the Message field,“Please Check !! Sum of Warranty should be Equal to Sum of Hardware Product.”
- Click Save
Step 4: Create an Error Condition to Leverage a Summary Variable
- In the Error Conditions related list, clickNew.
- Index:10.
- In the Tested Variable field, search for and selectSum of Warranty (Tata Cars).
- For the Operator field, choose less than.
- For the Filter Type field, chooseVariable
- In the Filter Variable field, enterSum of Hardware(Tata Cars).
- ClickSave.
Step 5: Create an Error Condition to Leverage a Summary Variable
- In the Error Conditions related list, clickNew.
- Index:20.
- In the Tested Variable field, search for and selectSum of Warranty (Tata Cars).
- For the Operator field, choose Greater than.
- For the Filter Type field, chooseVariable
- In the Filter Variable field, enter Sum of Hardware(Tata Cars).
- Click Save.
Step 6: Save configuration rule by making it Active as per picture
Final Step Testing :Test the Validation Rule
- ClickAccounts in the Navigation bar.
- Click The Name of Account.
- Click the Related tab.
- From the Quotes related list, click Q-XXXX.
- Click Edit Lines.
- Click Add Products..(Warranty, Tata Cars, Keys, Toolkit)
- Update the quantity of theWarranty
- Click Save.
If Sum of all Hardware Products is not equal to Sum of Warranty Products then this validation rule will fire and then it does allow to save this quote.