---
schema_version: "1"
id: 202382c6cfbe75d74a797931e462d0a3a7c1a43e0709ff9e4460aa8cbc82ace8
title: Expression Modes and Custom Expressions
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_expression_modes_and_custom_expressions.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_expression_modes_and_custom_expressions.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 1b8175a53da7b69968f25371755cbfe28fd1065dbc048d15c7daeb0831627dee
description: 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.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Expression Modes and Custom Expressions

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.

The possible expression modes are:

- And (the default): Requires that all of the child rules in the rule set pass for the rule set to pass. If one child rule fails, the rule set fails. Used only with qualification rules.
- Or: Requires that only one of the child rules in the rule set passes for the rule set to pass. If one child rule passes, the rule set passes. Used only with qualification rules.
- Custom: Uses a custom logical expression defined in the Expression property to evaluate the rule set. Used only with qualification rules. See [Custom Expression Definition](https://help.salesforce.com/s/articleView?id=ind.comms_expression_modes_and_custom_expressions.htm&release=264.0.0&type=5 "When the Expression Mode is set to Custom, you can create a custom logical expression that the rules engine uses to evaluate the children rules. You enter the custom expression in the Expression property in the rule set.") for more information.
- If Else If: Evaluates the first child rule in the rule set and if it does not pass, continues to subsequent children rules in the sequence. After a rule passes, it stops processing. The best practice is to set the last rule to always be true, creating a fallback action. Used with penalty rules to apply different penalty amounts using context actions.
- If: Evaluates the first child rule in the rule set. If it does not pass, continues to evaluate all subsequent child rules in sequence. Continues to process until all child rules are processed. Used with penalty rules, when more than one penalty may be applied.

![Expression Mode settings of If Else If and If are described in the preceding text.](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/expression_mode.jpg)

![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 While creating rules with custom expressions, make sure that rule names aren’t subsets or supersets of each other.

## Custom Expression Definition

When the **Expression Mode** is set to **Custom**, you can create a custom logical expression that the rules engine uses to evaluate the children rules. You enter the custom expression in the **Expression** property in the rule set.

When writing the custom expression, use the following syntax rules:

- Use AND and OR operators only.
- Refer to child context rules using rule codes.
- Use spaces to delimit each expression element.
- Use parentheses to sequence order of operations for the expression.
- Expressions are case-sensitive.

The following are some example expressions:

```
( Rule1Code OR Rule2Code )
( ( Rule1Code AND Rule2Code ) OR ( Rule3Code AND Rule4Code ) )
( ( Rule1Code OR Rule2Code ) AND ( Rule3Code ) AND ( Rule4Code ) )
```