---
schema_version: "1"
id: 43ce53f77067ce9b6a920fa5232476dbd11a5c0e7d458a5dd3c9dc993fc9c39b
title: Setting Context Rule Conditions
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_setting_context_rule_conditions.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_setting_context_rule_conditions.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 4a36a57613a1bb81abcb22364fade7f4c7094b57fe686b4434d45a034e35bff0
description: "Context rules can have one or more rule conditions. Rule conditions can be either:"
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Setting Context Rule Conditions

Context rules can have one or more rule conditions. Rule conditions can be either:

- Simple: A condition that compares a context dimension value to a context mapping value.
- Function: A condition that compares the function's output to a static value.

To set context rule conditions:

1. Specify one or more rule conditions.
    
    1. In the sidebar, click **Rule Conditions**.
    2. In the **Rule Conditions** facet, click **Add Condition**.
    3. Select **Simple** or **Function**.
    4. For simple rule conditions, enter the following information in the **General Properties** area.
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
            <colgroup>
              <col style="width:33.33333333333333%">
              <col style="width:33.33333333333333%">
              <col style="width:33.33333333333333%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d184054e111">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d184054e117">
                  <p style="margin-bottom:0;">Value</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d184054e123">
                  <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="d184054e111 ">
                  <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="d184054e117 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e123 ">
                  <p>The code by which you refer to this rule condition. Use the 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 the rule condition code is used to create custom expressions, the 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="d184054e111 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Context Dimension</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e117 ">
                  <p style="margin-bottom:0;">Select a context dimension using the <strong class="uicontrol">Context Dimension Lookup</strong> dialog box.</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e123 ">
                  <p style="margin-bottom:0;">Specifies the context dimension to use with this rule condition.</p>
                </td>

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

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

                    <li>
                      <p>
                        <strong class="uicontrol">&gt;=</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">&lt;</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">&lt;=</strong>
                      </p>
                    </li>

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

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

                    <li>
                      <p>
                        <strong class="uicontrol">&lt;&gt;</strong>
                      </p>
                    </li>

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

                    <li>
                      <p>
                        <strong class="uicontrol">NOT LIKE</strong>
                      </p>
                    </li>

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

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

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e123 ">
                  <p style="margin-bottom:0;">Specifies the operator the context rule service uses to compare the <strong class="uicontrol">Value</strong> property to the context mapping.</p>
                </td>

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

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e117 ">
                  <p>Depending on the context dimension domain type, the Value property displays different selections.</p>
                  <ul>
                    <li>
                      <p>If the domain type is <strong class="uicontrol">Type In</strong>, the <strong class="uicontrol">Value</strong> property displays a text box that enables you to enter a free form string value.</p>
                    </li>

                    <li>
                      <p>If the domain type is <strong class="uicontrol">Object Lookup</strong>, the Value property displays a lookup dialog box that you specified in the context dimension.</p>
                    </li>

                    <li>
                      <p>If the domain type is <strong class="uicontrol">Picklist</strong>, the value property displays the Vlocity picklist you specified in the context dimension.</p>
                    </li>

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e123 ">
                  <p>Specifies the value the context rule service uses to compare to the context mapping.</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-tip"><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_tip.png" alt="Tip"></span></div>
                      <div class="slds-media__body" style="padding-top:.5rem;padding-bottom:.5rem;"><span class="slds-text-title_caps">Tip</span>
                        <p>If the context dimension is </p>
                      </div>
                    </div>
                  </div>
                </td>

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

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

                    <li>
                      <p>
                        <strong class="uicontrol">Soft Pass</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">Soft Fail</strong>
                      </p>
                    </li>

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e123 ">
                  <p style="margin-bottom:0;">Fail Level is not implemented currently in Industries Cart.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e111 ">
                  <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="d184054e117 ">
                  <p style="margin-bottom:0;">String value</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e123 ">
                  <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>
            </tbody>
          </table>
2. Click **Save**.
3. For function rule conditions, enter the following information in the **General Properties** area.
    
    <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="d184054e505">
                  <p style="margin-bottom:0;">Property</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d184054e511">
                  <p style="margin-bottom:0;">Value</p>
                </th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d184054e517">
                  <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="d184054e505 ">
                  <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="d184054e511 ">
                  <p style="margin-bottom:0;">String</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e517 ">
                  <p>The code by which you refer to this rule condition. Use this 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 condition code is used to create custom expressions, the 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="d184054e505 ">
                  <p style="margin-bottom:0;">
                    <strong class="uicontrol">Vlocity Function</strong>
                  </p>
                </td>

                <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e511 ">
                  <p style="margin-bottom:0;">Select a function using the <strong class="uicontrol">Vlocity Function Lookup</strong> dialog box.</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e517 ">
                  <p style="margin-bottom:0;">Specifies the function to use for this rule condition. After it is selected, the function's input and output arguments display in the <strong class="uicontrol">Rule Condition</strong> dialog box.</p>
                </td>

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

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

                    <li>
                      <p>
                        <strong class="uicontrol">&gt;=</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">&lt;</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">&lt;=</strong>
                      </p>
                    </li>

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

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

                    <li>
                      <p>
                        <strong class="uicontrol">&lt;&gt;</strong>
                      </p>
                    </li>

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

                    <li>
                      <p>
                        <strong class="uicontrol">NOT LIKE</strong>
                      </p>
                    </li>

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

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

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e517 ">
                  <p style="margin-bottom:0;">Specifies the operator the context rule service uses to compare the <strong class="uicontrol">Value</strong> property to the function's output.</p>
                </td>

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

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

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e517 ">
                  <p style="margin-bottom:0;">Specifies the value the context rule service uses to compare to the function's output.</p>
                </td>

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

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

                    <li>
                      <p>
                        <strong class="uicontrol">Soft Pass</strong>
                      </p>
                    </li>

                    <li>
                      <p>
                        <strong class="uicontrol">Soft Fail</strong>
                      </p>
                    </li>

                  </ul>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e517 ">
                  <p style="margin-bottom:0;">Fail level is not implemented currently in Industries Cart.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Property" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e505 ">
                  <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="d184054e511 ">
                  <p style="margin-bottom:0;">String value</p>
                </td>

                <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d184054e517 ">
                  <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>
            </tbody>
          </table>
4. In the **Function** area of the **Rule Condition** dialog, the input and output arguments of the function are displayed. Depending on the function's input arguments' domain types, you can specify values in Object Lookup, Context Dimension, Type in, or Vlocity Picklist.
    
    ![In the ​Function​ area of the ​Rule Condition​​ dialog, a Context Dimension value of CurrentOrder is specified.](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/rule_condition_function.jpg)
5. Save your changes.

After creating the context rule, the next step is to create a rule set. For more information about creating rule sets, see [Creating Rule Sets](https://help.salesforce.com/s/articleView?id=ind.comms_create_rule_sets.htm&release=264.0.0&type=5 "A rule set is a logical grouping of one or more context rules. A rule set enables you to designate how the grouped context rules are expressed in a logical expression and how they are used in Industries Cart. To create a rule set, you define general properties and then specify one or more context rules as child rules.").

![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 Regularly check rule assignments to make sure that all associated rules are active. For information on managing inactive rules, 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.").