Use Nested Rules

Nested rules help you avoid having to write complicated conditions and can improve rule organization, especially if you have lots of rules.

A nested rule is simply a parent rule with one or more child rules, indicated in the UI by indentation. When you use nested rules, the children of a rule can override the properties set by its parent(s).

Here's a simple example:



This example shows two sets of nested rules:

  • Country is USA and Country is Canada are at the same level
  • Full Time Employees is nested beneath Country is USA
  • Hire Date before 2023 and Hire Date after 2023 are both children of Full-time Employees.

The red numbers indicate the order in which these rules are evaluated at runtime. Let’s take a closer look at what that means:

  1. Evaluation begins at the bottom with Country is Canada. If the conditions for this rule are met, the rule’s property overrides are applied. Next:
  2. Country is USA is evaluated.
    • If the rule's conditions are NOT met, the rule doesn't override any properties. In addition, its child rules (Full-time Employees) are never evaluated.
    • If the conditions for Country is USA ARE met, the property overrides defined in the rule are applied, and Full-time Employees is evaluated.
  3. If the conditions for Full-time Employees are NOT met, the rule does not apply any properties, and its children (Hire Date after 2023 and Hire Date before 2023) are never evaluated.
  4. If the conditions for Full-time Employees ARE met, the property overrides defined in the rule are applied, and its children are evaluated.
    • Hire Date after 2023 is evaluated first, because it is lowest, followed by Hire Date before 2023.

Although you could write a more complex set of conditions to achieve the same outcome, nested rules make it much simpler to apply multiple property overrides at runtime.

Add a child rule

You can add a child rule to any of your extension rules:

  1. Click + next to the rule that you want to be the parent rule.

  2. Type the Label of the child rule. (The ID field is automatically populated based on the Label, but you can type a different ID if you want.) Click Create.
  3. Right-click the child rule, and then use Move up and Move down in the options menu to move the rule into the position you want.

    Remember, child rules that are peers are evaluated from the bottom up, so the order is important.



When you duplicate a rule, the rule's children are also duplicated. In the example above, if you duplicated Full-time Employees, a new rule (Full-time Employees copy) will appear under the parent (Country is USA), along with its child rules Hire Date not set, Hire Date before 2023, and Hire Date after 2023.

Note:

You cannot duplicate rules defined in extension dependencies (the rules listed under Built-in Rules), which includes the Default rule.