Show TOC

PreconditionLocate this document in the navigation structure

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.

Example

Rule D has a precondition Rule C must not be satisfied . This implies that if Rule C is satisfied, Rule D will not be satisfied.

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.

Example

Rule A

If

 
 

Condition 1

 

and Condition 2

 

and Condition 3

Then

 
 

...

Rule B

If

 
 

Condition 1

 

and Condition 2

 

and Condition 4

Then

 
 

...

You can re-organize these rules as:

Pre Rule

 

If

 
 

Condition 1

 

and Condition 2

Then

 
 

...

Rule A

Precondition Pre Rule

 

If

 
 

and Condition 3

Then

 
 

...

Rule B

Precondition Pre Rule

 

If

 
 

and Condition 4

Then

 
 

...

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