Object rules are self-contained
Each individual rule attached to an object should be self-explanatory and independent of other rules. In other words, it should include all necessary conditions to clearly specify when the rule action should be executed. There are two important reasons for this principle.
Reason 1
If specific conditions for the rule action are not defined, the action can be executed at the wrong time leading to the wrong results.
Reason 2
A rule cannot depend on execution of actions of other rules since the order in which object rules are executed is not defined.
For example, the following rule initialises the account address with a default value. Once the address is given the rule action will not be executed again:
IF Account.Address IS UNDEFINED THEN Account.Address = Account.Holder.Address
If we removed the condition the rule would execute every time the Account object is changed, thereby overwriting the address manually entered by the user.
In another example the rule below ensures that the transaction amount cannot be changed once the transaction is completed. If the condition were removed the system would not allow changing the amount at any time, including the initial entry of the transaction details:
IF Transaction.State = 'Approved' THEN PROTECT Transaction.Amount FROM ALL
Let us consider yet another example in which the final action is determined by several possibly dependent events or facts. There may be a requirement to notify the library member when an item the member reserved is returned to the library. If the e-mail address of the member is known the member is notified by e-mail, otherwise a letter is posted to the member. These requirements are implemented in Aware IM by two self-contained and independent rules attached to the Reservation object:
Rule 1:
IF Reservation.Status WAS CHANGED TO 'Offered' AND Reservation.Member.EmailAddress IS DEFINED THEN SEND ReservaitonOfferEmail TO Reservation.Member
Rule 2:
IF Reservation.Status WAS CHANGED TO 'Offered' AND Reservation.Member.EmailAddress IS UNDEFINED THEN PRINT DOCUMENT ReservationLetter