Expand
Rule Logical Expression OR is not correctly firing the rule
Answer ID 5126   |   Last Review Date 03/26/2019

## When I use the OR logical expression, why isn't the rule firing correctly?

Environment:

Resolution:

Logical expressions use AND (&) and OR ( | ) to define the relationship between a rule's conditions. The following shows an example of a logical expression in an incident rule.

The logical expression: 1 & 2 & 3 | 4

This expression should fire the rule even if only condition 4 is met.  However, the best practice for rules in this case is to add parenthesis around the 1 & 2 & 3.

So it would be: (1 & 2 & 3) | 4

If you do not use parentheses, AND always has precedence over OR, which determines the order of execution.

More examples of a logical expressions:

1 & (2 | 3) - This expression requires that condition 1 be met and that either condition 2 or condition 3 must also be met.

1 & 2 | 3 - This expression requires that both conditions 1 and condition 2 be met or that condition 3 be met.