---
schema_version: "1"
id: 81665ee009eef8afb36df40159772bda1686c26c04e133afe076f8c1a4a79d31
title: Create Context Rules
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_create_context_rules.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_create_context_rules.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c64712ec01cbb3abbb2e5f3162b12fe68e33f45f4cc05909b23e9751c983be67
description: Context rules determine when a rule set applies in Industries Cart. Context rules contain rule conditions, which are made up of context dimensions, context scopes, and context mappings. Context rules are analogous to entity filters in the Advanced Rules framework.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Create Context Rules

Context rules determine when a rule set applies in Industries Cart. Context rules contain rule conditions, which are made up of context dimensions, context scopes, and context mappings. Context rules are analogous to entity filters in the Advanced Rules framework.

Starting in Summer '18, context rules, rule sets, and rule conditions are cached in the org cache of the [CPQPartition](https://help.salesforce.com/s/articleView?id=ind.comms_configuring_cpq_platform_cache.htm&language=en_US). In order to see your changes reflected at runtime, run the [Clear Managed Platform Cache](https://help.salesforce.com/s/articleView?id=ind.comms_clear_managed_platform_cache.htm&language=en_US) job in the CMT Administration Maintenance jobs page.

Prerequisites:

- [CPQPartition](https://help.salesforce.com/s/articleView?id=ind.comms_configuring_cpq_platform_cache.htm&language=en_US) exists and has appropriate org and session cache allocations.

To create a context rule, define the rule's general properties and then specify one or more rule conditions:

1. In the Product Console, in the Rules list, next to Rule, click **Create**. ![The plus icon for Create](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/productconsole_create.jpg)
2. Enter the following information:
    
    <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="d188507e89">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d188507e95">
                  <p style="margin-bottom:0;">Value</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d188507e101">
                  <p style="margin-bottom:0;">Description</p>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Name</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">String value</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">The context rule name</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Code</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">String value</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p>The code by which you refer to this context rule. Use the rule code when
                    creating custom expressions. For more information, see <a href="https://help.salesforce.com/s/articleView?id=ind.comms_expression_modes_and_custom_expressions.htm&amp;release=264.0.0&amp;type=5" title="When a rule set contains more than one child context rule, you must use the expression mode to specify how the rules engine combines the child rules into a logical expression.">Expression Modes and Custom Expressions</a>.</p>
                  <div class="slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium">
                    <div class="slds-media slds-media_responsive">
                      <div class="slds-media__figure"><span class="slds-icon_container slds-icon_container_circle slds-icon-note-warning"><img style="margin-bottom:0;" src="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_important.png" alt="Important"></span></div>
                      <div class="slds-media__body" style="padding-top:.5rem;padding-bottom:.5rem;"><span class="slds-text-title_caps">Important</span>
                        <p>Because rule code is used when creating custom expressions, the rule code
                          should be unique, descriptive, and contain no spaces.</p>
                      </div>
                    </div>
                  </div>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Description</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">String value</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">Describe the context rule's purpose.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Expression Mode</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <ul>
                    <li>
                      <p>
                        <strong class="uicontrol">AND</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">OR</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">Custom</strong>
                      </p>
                    </li>

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">Use expression mode when the rule contains multiple conditions. It specifies
                    how the rules engine compiles the rule conditions into a logical expression.
                    For more information, see <a href="https://help.salesforce.com/s/articleView?id=ind.comms_expression_modes_and_custom_expressions.htm&amp;release=264.0.0&amp;type=5" title="When a rule set contains more than one child context rule, you must use the expression mode to specify how the rules engine combines the child rules into a logical expression.">Expression Modes and Custom Expressions</a>.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Expression</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <ul>
                    <li>
                      <p>Use AND and OR operators to create custom expressions.</p>
                    </li>

                    <li>
                      <p>Refer to conditions using condition codes.</p>
                    </li>

                    <li>
                      <p>Use spaces to delimit each code.</p>
                    </li>

                    <li>
                      <p>Use parentheses to sequence the operations for the expression.</p>
                    </li>

                    <li>
                      <p>Expressions are case-sensitive.</p>
                    </li>

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">Use expression when the expression mode is set to
                    <strong class="uicontrol">Custom</strong>. It enables you to specify a custom logical
                    expression. For more information, see <a href="https://help.salesforce.com/s/articleView?id=ind.comms_expression_modes_and_custom_expressions.htm&amp;release=264.0.0&amp;type=5" title="When a rule set contains more than one child context rule, you must use the expression mode to specify how the rules engine combines the child rules into a logical expression.">Expression Modes and Custom Expressions</a>.
                  </p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Failure Message</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">String value</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">This message is not currently displayed in Industries Cart. Instead, set the
                    failure message on the rule set. For more information about failure messages,
                    see <a href="https://help.salesforce.com/s/articleView?id=ind.comms_failure_messages.htm&amp;release=264.0.0&amp;type=5" title="When creating context rules, you can create failure messages for the following entities: rule sets, context rules, and rule conditions.">Failure Messages</a>.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Active</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">Click to select</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">The context rule service evaluates only active context rules.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Effective Start Date</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">Select a date</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">The start date of the period during which the rule is effective.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e89 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Effective End Date</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e95 ">
                  <p style="margin-bottom:0;">Select a date</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d188507e101 ">
                  <p style="margin-bottom:0;">The end date of the period during which the rule is effective.</p>
                </td>

              </tr>
            </tbody>
          </table>
3. Save your changes.

![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 See [Troubleshoot Context Rules and GetCartProducts API Issues](https://help.salesforce.com/s/articleView?id=ind.comms_troubleshoot_context_rules_and_getcartproductsapi_issues.htm&release=264.0.0&type=5 "When you use GetCartProducts API along with context rules, you can run into some issues. The table below lists some common issues and their resolutions.").