Discover Interface Implementations for Industries CPQ Rules
Learning Objectives
After completing this unit, you’ll be able to:
- List the primary interfaces and implementations used in the context rules framework.
- Describe how interfaces and implementations are used in advanced rules.
The Industries CPQ Rules Framework
In the Order Capture process, rules are essential to creating the right order. You can use rules to control all the products and services offered to customers, including offering them at the correct prices. You can also use rules to assess the appropriate penalties for order changes and cancellations in line with your business objectives.
Salesforce Industries provides two frameworks to accomplish your business objectives: Context Rules and Advanced Rules. To explore the two frameworks, check out this interactivity. Click each framework to learn more about them.
The Context Rules framework and Advanced Rules framework work in tandem to run business rules in your Industries Configure, Price, Quote (CPQ) environment. It’s important to understand your customer requirements end-to-end before you decide on which rule to use.
Refer to the Resources section to learn more about Context Rules and Advanced Rules.
Interface Implementations for Context Rules
You can assign multiple prices to a product, and pricing rules determine the price available to the customer. There are many variables that determine eligibility, such as geography, customer segment, and promotional discounts. But what if the customer is eligible for multiple prices? In the end, a single price must be set. That’s when interfaces and implementations come into play.
In this section, you learn about the primary interfaces and implementations used by the context rules framework. So, jump right in!
ContextRuleService
This interface has only one implementation, which is also named ContextRuleService. Easy to remember, right? Make this implementation active and default for context rules to work.
[Alt text: The ContextRuleService interface with one available implementation.]
This implementation evaluates rule conditions to qualify objects like promotions and products or to identify action sets when a penalty action occurs.
ProductAvailabilityOpenInterface
You call this interface when the application must provide a list of products for the customer to select. This interface has two implementations.
[Alt text: ProductAvailabilityOpenInterface with available implementations.]
- DefaultAvailabilityOpenImplementation returns the list of products without running context rules. You mainly use this implementation when you do not have any context rules to apply.
- CtxRulesProductsOpenImplementation returns only those products that meet the context rules set. To deploy context rules for products, make this implementation active and default.
There’s no similar interface for context rules for promotions. It's just included as part of ContextRuleService.
TightestMatchInterface
This interface determines which price list entry is selected if the customer is eligible for multiple qualified price list entries. It includes two implementations.
[Alt text: TightestMatchInterface with available implementations.]
- TightestMatchServiceImplementation is the default implementation that uses condition weights to determine which price list entry to select.
- FirstMatchImplementation, as the name implies, ignores those weights and selects the first match that it finds.
Here’s a deeper dive to understand how condition weights work. When a customer adds a product to the cart, the rules engine determines all the qualified child price lists and price list entries based on the configured rules. Then, the engine assigns a weight to each qualified price list entry, using the formula 2x + 2y.
Here, x is the condition weight set on the context dimension used by the child price list rule, and y is the condition weight set on the context dimension used by the price list entry rule.
Condition weights are calculated from context dimensions for each rule condition assigned to the child price list if it exists, plus the price list entry. Then, a total weight is assigned to each price list entry.
To simplify your rules environment, the right approach is to leave the condition weight property blank for most context dimensions. Then, when you want to prioritize certain criteria, it is easy to weight conditions quickly because 21=2, 22=4, 23=8, and so on.
The Tightest Match algorithm assumes that:
- Price list entries (PLEs) with no context rule are assigned a condition weight of 0, or 20, which equals 1.
- PLEs with a context rule that has a null condition weight are evaluated as 0, or 20, which equals 1.
- PLEs with condition weights greater than 60 default to 0, or 20, which equals 1.
- Context rules on parent price lists are not evaluated.
- If multiple price list entries have the highest weight, the interface selects the most recently created price list entry and applies that price to the line item.
The condition weight value is used by TightestMatchServiceImplementation to calculate the relative weight of a price list entry. The implementation is used only for rules assigned to price list entries or child price lists and not for rules assigned to products and promotions.
Next, you learn about the key interfaces and implementations used by the advanced rules framework.
Interface Implementations for Advanced Rules
Salesforce Industries provides a variety of interfaces for advanced rules with default implementations. The default implementations allow the Cart to run, but they don’t invoke any rules. You must activate different implementations to apply rules. You can use these implementations, or choose to create your own custom or hybrid implementation. Here’s a look at some interfaces and implementations that the advanced rules framework uses.
ProductValidationInterface
This interface implements compatibility rules, also known as configuration or validation rules. It includes these implementations.
[Alt text: ProductValidationInterface with available implementations.]
- DefaultProductValidationImplementation returns whatever input it receives as output without any changes, that is, it does not implement your validation or compatibility rules.
- ValidationRulesImplementation runs all product relationships and active compatibility rules for the opportunity, order, or quote.
- ProductRelationshipValidationImpl is a legacy implementation that is no longer supported.
These rules specify the relationships between products. In Industries CPQ Advanced Rules, a product can require, recommend, or exclude another product. ProductValidationInterface validates the compatibility of the products in an opportunity, order, or quote. ProductValidationInterface is typically triggered when a product is added to, modified in, or deleted from an opportunity, order, or quote.
ProductAvailabilityInterface
This interface implements availability rules and has three implementations.
[Alt text: ProductAvailabilityInterface with available implementations.]
- LocaleProductAvailability runs standard availability rules.
- DefaultProductAvailabilityImplementation doesn’t run availability rules. Instead, it returns the product list without any modification.
- FilterAvailabilityImplementation runs advanced availability rules when the sequence of those rules is unimportant.
ProductAvailabilityInterface comes into play when there’s a request for specifying which products are available for a specific shipping location, account, or account attributes.
ProductEligibilityInterface
This interface comes into play immediately after the ProductAvailability interface and implementation. This interface has three implementations.
[Alt text: ProductEligibilityInterface with available implementations.]
- AccountTypeProductEligibility runs standard eligibility rules.
- DefaultProductEligibilityImplementation returns the input without any modifications to eligibility.
- FilterEligibilityImplementation runs advanced eligibility rules when the sequence of those rules is unimportant.
ProductEligibilityInterface implements eligibility rules and specifies products that are available in certain locations but the customer isn't eligible for them.
PricingInterface
Pricing rules use PricingInterface and its four associated implementations to calculate correct pricing.
[Alt text: PricingInterface with available implementations.]
PricingInterface and its implementation are triggered when a product is added to, deleted from, or modified in an opportunity, order, or quote. You use this interface to create advanced rules that call calculation procedures as actions.
You Did It
Congratulations! You just explored the primary interfaces and implementations that the Industries CPQ rules framework uses. Use Salesforce Industries interfaces and implementations to change the way CPQ applications work by changing the active implementations for each interface. This is key to creating your custom logic. Use the right interface and implementation to achieve your desired output. Your company and customers will thank you.
Resources
- Salesforce Help: Context Rules and Advanced Rules Frameworks
- Salesforce Help: Context Rules or Advanced Rules: What Type to Use?