Precondition

Use

Preconditions help in reusing business rules.

As you create business rules, many rules may have common conditions and actions. You can define a rule with the common condition and use it as a precondition to other rules. This way maintaining the rules becomes easy.

For example, Rule A must be satisfied is a precondition to Rule B; Rule B is satisfied only when conditions in both rule A and rule B are satisfied.

A rule can have more than one precondition rule, in which case the rule is satisfied only if all the precondition rules are satisfied.

A rule used as a precondition may also contain actions. In such a case, when the precondition rule is satisfied, the actions in the precondition rule will be fired.

Typical Uses

When many rules have the same conditions, it is advisable to declare a rule that contains the common conditions and use it as a precondition in all the rules. This makes changing and maintaining rules easier.

You can see that the common conditions have been placed in a precondition rule, making it easier to change and manage these rules.