Constraint Rules are configuration rules used to conditionally include, exclude, recommend, replace, or validate a product or set of products based on other products or set of products added to the cart. For example, when Product A is added to the cart, Product B can be automatically added based on an auto-inclusion type rule. Similarly, when Product B is added to the cart, the sales rep can be prevented from adding Product C. Constraint rules are applied to a product during the product configuration process, either on the client-side or the server-side.
The constraint rule consists of three associated Objects:
- Constraint Rule Object: Header level object that links the condition with the action. There are only three significant properties in this object, the active flag, action association, and condition association. To configure a constraint rule, you must first create a constraint rule header.
- Constraint Rule Condition: Captures the condition that triggers the rule.
- Constraint Rule Action: Captures the rule action that is applied to the cart when the rule condition is satisfied.
CPQ supports five types of constraint rules. Each of the rules has support for their action intents on either server-side, client-side, or both.
|Server-Side Supported Functionalities
|Client-Side Supported Functionalities
|Used to add a product to the cart.
|If the Sales rep has selected a laptop, then automatically include a laptop charger.
|Used to exclude or prevent the addition of a product to the cart.
|If the Sales rep has selected a region where a certain model of laptop is not available, then disable that laptop model.
|Used to replace and add a product to the cart.
|If the Sales rep has selected a product that is deprecated or not available then replace that product with another product that is available in the catalog.
|Used to prompt product suggestions to the user for addition to the cart.
If the Sales rep has selected a laptop and has not selected a mouse, then recommend the user to select a mouse.
|Used to prevent the user from finalizing the cart without resolving validation errors.
|If the Sales rep chose a laptop and their limit was to buy only 5 units at a time, then validate the quantity.
Constraint rules are optimized with the client-side caching mechanism to improve performance and user experience. You can choose to process all constraint rules at the client-side or server-side, by defining the setting Constraint Rule Execution Mode, in Config System Properties.
The constraint rules are processed at the server-side by default. However, always use Client-Side Constraint Rules in a Service CPQ flow.
Note the following limitations when enabling Client-Side Constraint Rules (CSCR).
- Replacement type constraint rules are not supported.
- Product Scope, Option Groups, is not supported. If such a constraint rule is defined an error is displayed on the Catalog page.
- When you configure a constraint rule with Action Type = Exclusion and Min/Max Match Rule = Exclude After One, if the sales representative adds the product for the first time, CPQ displays a constraint rule message on the cart in the “Client” mode.
- Match in Assets in Match Conditions for Constraint Rule Actions is only supported for Inclusion type Client-Side Constraint Rule for Prompt, Auto-include, and Show Messages actions. For Exclusion type Client-Side Constraint Rule for Prompt, and Show Message actions.
Constraint rules are not executed on line items with the status as Cancelled. To avoid errors, add a criterion to exclude line items with line status as Cancelled in all such constraint rules.
You can also execute a constraint rule across the following bundle structures:
- From parent bundle structure to nested bundle structure
- From nested bundle structure to parent bundle structure
- Across nested bundles
You must follow the best practices while defining Constraint Rules. For more information, see CPQ Best Practices: Governor Limits.
Subsequent sections explain the following topics: