Introduction
Routing Rules can use AND and OR operators to create more flexible matching logic for attribute conditions. You can also create a nested condition group with its own AND/OR operator.
This makes it possible to build more advanced routing logic within a single rule instead of creating multiple Routing Rules for different combinations of conditions.
If you have any questions after reading this article, please contact us at support@oneio.cloud.
Overview
How AND and OR work
The operator determines how the conditions in a Routing Rule are evaluated.
With AND, all conditions must match for the rule to match.
Example:
We only want to send comments if the comment attribute exists and the comments are not generated by a system automation:
| Attribute Name | Validation | Value | Operator |
|---|---|---|---|
| comments | exists | AND |
|
| comments | does not contain | System Automation |
With OR, at least one of the conditions must match.
Example:
We want to trigger the comments rule if comments OR work_notes exist:
| Attribute Name | Validation | Value | Operator |
|---|---|---|---|
| comments | exists | OR |
|
| work_notes | exists |
Use a condition group
For more advanced matching, you can add a condition group. A group has its own AND/OR operator, allowing you to combine different types of logic within the same Routing Rule.
For example, you can create the following logic, where we only want to send comments if they exist, AND the Entity status has a valid open state (not closed or resolved) AND comments are not generated by a system automation, OR if work_notes exist, AND the Entity status is not closed.
| Attribute Name | Validation | Value | Operator |
|---|---|---|---|
| comments | exists | AND |
|
| comments | does not contain | System Automation | |
| status | not included in | Resolved or Closed | |
OR | |||
| work_notes | exists | AND |
|
| status | not included in | Closed | |
Create a Routing Rule with AND/OR conditions
Open the Routing Rule you want to configure and click on Add or Edit Attribute conditions
Start by choosing if you want to add a single or nested condition group.
Select the main condition you want to check: AND or OR. All single conditions or nested conditions inside this main condition will obey the selected condition you choose.
If you need to combine only one type of logic, add single conditions:
If you need to combine more than one type of logic or group of conditions, add a nested condition:
If you need to combine both types of logic, add a nested condition. Add the relevant conditions to the group and select AND or OR for the group.
Example:
Limitations
Condition groups support one level of grouping. You can add a group to the main list of conditions, but you cannot create another group inside that group.
For example, this type of structure is supported:
- A OR (B AND C)
A structure with additional nested groups, such as the following, is not supported:
- A OR (B AND (C OR D))
Attachment conditions cannot be added inside a condition group. Attachment conditions remain separate and must also match for the Routing Rule to match.
The AND/OR grouping functionality applies to supported attribute conditions. It does not introduce boolean grouping for other Routing Rule configuration areas such as operation conditions, response conditions, delay conditions, mappings, or source and target selectors.
Existing Routing Rules
Rules created without an explicit AND/OR selection use the AND behavior. When you open an existing rule in the conditions editor, its conditions are shown using the AND operator.
Existing Routing Rules continue to work as before, and you do not need to update existing Routing Rules to use the OR/AND condition model.
Comments
Please sign in to leave a comment.