Rule inheritance and child rules

Parent Previous Next

Rule Inheritance and Child Rules



Why and when to use rule inheritance and child rules?




Child rules in the tree


Child rules are added to a parent rule collection exactly the same way as rules are added to an account.



Rule traversal and matching


General rule traversal is always performed top down. Rules on the same level are checked in the order shown.

If a rule contains child rules, they are checked only if the parent rule matches.


Optional execution of the parent rule depends on the options described below and occurs after handling all its child rules.

Child rules can have their own child rules and rule matching and execution is applied the same way.


Rule checking options:


There are 3 options how rule traversal and matching is performed:



Enabled

When checked, the rule while be checked.

When unchecked, this rule and all its children are ignored, regardless if the children are enabled.


Valid Result

When checked the current rule is considered a valid rule that can be executed when matched.

When unchecked the rule is checked on matching patterns, and when matched will traverse its child rules, however the rule itself is never executed.  

Note: Disable this setting when using a parent rule for base rule matching and setting up global activities, without allowing the parent rule itself to be valid.


Final Result

When checked and matched, rule matching stops after this rule.

If the rule has child rules its children are checked first and if no child rule is matching, the parent rule itself is executed and rule matching stops.

If a child rule did match, the child rule is executed and rule matching stops.

This option is only applied if the rule has a valid result.


Execution options:


Execution options determine how a rule is executed



Process - Process the activities defined in the rule

Ignore - Mail is set as read, but no processing of its contents is performed

Finalization only - Mail is set as read and moved to another location (if set)



Examples of Rule Inheritance


To demonstrate the results of the settings as described above, a few examples using different settings are shown below.

The partial screen-shot  is used in each of the examples as a starting point.




Example 1


Description

Rule matching occurs sequentially and in the order the rules are shown.


Settings

 All rules:

- Valid result = true

- Set as final rule = true

- Execution mode = Process


Processing

Simple flow were all rules will be checked and rule checking stops on the first match, the matching rule is executed.


With these settings and using the above rule screen shot, RuleFirst is checked first

- If matched, RuleFirst is executed and rule matching stops

- If there is no match, RuleParentA is checked



Example 2


Description:  

All rules are checked and only the first match is executed, however if RuleParentA is matched, but none of its children, RuleParentA is not considered a valid rule and is not executed.


Settings

RuleParentA

- Valid result = false

- Set as finale = true

- Execution mode = Process


All other rules:

- Valid result = true

- Set as final rule = true

- Execution mode = Process


Processing

- Check RuleFirst

- If it is matched RuleFirst is executed and rule matching stops

- If there is no match, RuleParentA is checked

If there is no match, RuleParentA is skipped and RuleParentB is checked in the same way



Example 3


Description

All rules are checked and every matching rule is executed, however if RuleParentA is matched, some or all of its children may match and executed, but RuleParentA itself is not considered a valid rule and is not executed.


Settings

RuleParentA

- Valid result = false

- Set as finale = true

- Execution mode = Process


All other rules:

- Valid result = true

- Set as final rule = false

- Execution mode = Process


Processing

- Check RuleFirst

- If it is matched, RuleFirst is executed and rule matching continues

- Next RuleParentA is checked



Example 4


Description

All rules are checked and every matching rule is executed, however if RuleParentA is matched, some or all of its children may match and are executed,

but RuleParentA will only execute its finalization functions. This combination of settings can be useful to allow multiple rule matching for only a specific group of rules.        


Settings

RuleParentA

- Valid result = true

- Set as finale = true

- Execution mode = FInalize only


All other rules:

- Valid result = true

- Set as final rule = false

- Execution mode = Process


Processing

- Check RuleFirst

- If it is matched, RuleFirst is executed and rule matching continues

- Next RuleParentA is checked