---
schema_version: "1"
id: 75709fd595ea6a39d97512662f69d00e51e18e3fc4e44dfeb1ea8d3a2fe0b583
title: Context Rules Framework
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_context_rules_framework.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_context_rules_framework.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d1083ff4f8d09e6af6080458517b2afeb06136e3a5ddc516211fadfd218a83d1
description: Use the context rules framework to build rules that change what products, promotions, and prices appear for customers. You can also apply penalties for promotions or contracts that are canceled.You can also create rules to ensure pricing adjustments are allowed only in certain conditions. Context rules work together with advanced rules framework to ensure all orders are configured and priced correctly.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Context Rules Framework

Use the context rules framework to build rules that change what products, promotions, and prices appear for customers. You can also apply penalties for promotions or contracts that are canceled.You can also create rules to ensure pricing adjustments are allowed only in certain conditions. Context rules work together with advanced rules framework to ensure all orders are configured and priced correctly.

There are two primary types of context rules: Qualification and Penalty. These rule types have different uses in Industries Cart. See [Types of Context Rules](https://help.salesforce.com/s/articleView?id=ind.comms_types_of_context_rules.htm&release=264.0.0&type=5 "In the Vlocity Product Console, you can create the following types of context rules: Qulification rules and Penalty Rules.").

Create and manage context rules in the Product Console. Build context rules with reusable components. Context rules can be combined into rule sets and applied to products, promotions, price lists, and price list entries. They can also be applied to virtual objects. See [Context Rules Components](https://help.salesforce.com/s/articleView?id=ind.comms_context_rule_components.htm&release=264.0.0&type=5 "You build context rules by combining context rule components. Over time, this will establish a library of components that can reduce overall development time and expedite new development.").

**Context Rules Framework Components**

![In the Context Rules Framework, trigger events and interface implementations activate rulesets, which contain context rules. Context rule components can be combined and reused.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/resources-product/images/context_rules_framework.jpg)

## Setting Up Context Rules Framework

The following interface implementations must be active and set to their default values to enable the specified types of context rules.

**Interface Implementations**

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col>
          <col>
          <col>
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d405438e82">
              <p style="margin-bottom:0;">Interface</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d405438e88">
              <p style="margin-bottom:0;">Implementation</p>
            </th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d405438e94">
              <p style="margin-bottom:0;">Enables which context rules?</p>
            </th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Interface" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e82 ">
              <p style="margin-bottom:0;">
                <span class="apiname">ContextRuleService</span>
              </p>
            </td>

            <td data-label="Implementation" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e88 ">
              <p style="margin-bottom:0;">
                <span class="apiname">ContextRuleService</span>
              </p>
            </td>

            <td data-label="Enables which context rules?" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e94 ">
              <p style="margin-bottom:0;">For all types of context rules</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Interface" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e82 ">
              <p style="margin-bottom:0;">
                <span class="apiname">ProductAvailabilityOpenInterface</span>
              </p>
            </td>

            <td data-label="Implementation" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e88 ">
              <p style="margin-bottom:0;">
                <span class="apiname">CtxRulesProductsOpenImplementation</span>
              </p>
            </td>

            <td data-label="Enables which context rules?" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e94 ">
              <p style="margin-bottom:0;">For qualification context rules for products</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Interface" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e82 ">
              <p style="margin-bottom:0;">
                <span class="apiname">PricingManAdjEligibilityInterface</span>
              </p>
            </td>

            <td data-label="Implementation" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e88 ">
              <p style="margin-bottom:0;">
                <span class="apiname">PricingManAdjEligibilityService</span>
              </p>
            </td>

            <td data-label="Enables which context rules?" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e94 ">
              <p style="margin-bottom:0;">For qualification context rules for pricing adjustments</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Interface" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e82 ">
              <p style="margin-bottom:0;">
                <span class="apiname">RepricingManAdjEligibilityInterface</span>
              </p>
            </td>

            <td data-label="Implementation" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e88 ">
              <p style="margin-bottom:0;">
                <span class="apiname">RepricingManualAdjEligibilityService</span>
              </p>
            </td>

            <td data-label="Enables which context rules?" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e94 ">
              <p style="margin-bottom:0;">For qualification context rules for pricing adjustments used in a repricing batch job</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Interface" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e82 ">
              <p style="margin-bottom:0;" id="comms_context_rules_framework__uuid-56ba992a-5445-9a1e-4506-eac41977ca0c_para-idm693132496363660"><a name="comms_context_rules_framework__uuid-56ba992a-5445-9a1e-4506-eac41977ca0c_para-idm693132496363660"><!-- --></a>
                <span class="apiname">TightestMatchInterface</span>
              </p>
            </td>

            <td data-label="Implementation" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e88 ">
              <p style="margin-bottom:0;">
                <span class="apiname">TightestMatchServiceImplementation</span>
              </p>
            </td>

            <td data-label="Enables which context rules?" class="slds-cell-wrap" style="vertical-align:top;" headers="d405438e94 ">
              <p style="margin-bottom:0;">For qualification context rules for price list entries and child price lists</p>
            </td>

          </tr>
        </tbody>
      </table>

**CPQ Configuration Setup Custom Settings**

The context rules framework uses the following CPQ configuration custom settings:

- [ContextRulesEnabledCPQ Configuration Settings Reference](https://help.salesforce.com/s/articleView?id=ind.comms_t_cpq_configuration_settings_reference_148927.htm&type=5&language=en_US): true (required)
- [ContextRulesCacheModeCPQ Configuration Settings Reference](https://help.salesforce.com/s/articleView?id=ind.comms_t_cpq_configuration_settings_reference_148927.htm&type=5&language=en_US)
- [CPQ Toast Message Log LevelCPQ Configuration Settings Reference](https://help.salesforce.com/s/articleView?id=ind.comms_t_cpq_configuration_settings_reference_148927.htm&type=5&language=en_US)

**CPQPartition Session Cache**

Configure the CPQPartition session cache to support the context rules framework as follows:

- Set the CPQ Configuration Setup [CacheEnabledCPQ Configuration Settings Reference](https://help.salesforce.com/s/articleView?id=ind.comms_t_cpq_configuration_settings_reference_148927.htm&type=5&language=en_US) custom setting to true.
- Allocate 5 MB or more to the CPQPartition platform cache Session Cache. See [Creating a Platform Cache Partition](https://help.salesforce.com/s/articleView?id=ind.comms_creating_a_platform_cache_partition.htm&type=5&language=en_US).

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/images/icon_note.png)

Note

The CPQ Configuration Setup

- **[Types of Context Rules](https://help.salesforce.com/s/articleView?id=ind.comms_types_of_context_rules.htm&release=264.0.0&type=5)**  
    In the Vlocity Product Console, you can create the following types of context rules: Qulification rules and Penalty Rules.
- **[Context Rule Components](https://help.salesforce.com/s/articleView?id=ind.comms_context_rule_components.htm&release=264.0.0&type=5)**  
    You build context rules by combining context rule components. Over time, this will establish a library of components that can reduce overall development time and expedite new development.
- **[Functions for Rules](https://help.salesforce.com/s/articleView?id=ind.comms_functions_for_rules.htm&release=264.0.0&type=5)**  
    In context rules, when you need rules to evaluate complex criteria, you can create a function.
- **[Using Context Rules to Check User's Eligibility in Self-Service Transactions](https://help.salesforce.com/s/articleView?id=ind.comms_using_context_rules_to_check_user_s_eligibility_in_self_service_transactions.htm&release=264.0.0&type=5)**  
    The following configurations enable you to evaluate the eligibility of the logged-in user for self-service transactions:
- **[Migrate Context Rules Between Environments](https://help.salesforce.com/s/articleView?id=ind.comms_migrate_context_rules_between_environments.htm&release=264.0.0&type=5)**  
    You can migrate context rules from one environment to another, for example from a Sandbox environment to a Production environment.