Chapter 2 Project Design Tutorial : Configure the CheckNegativeBalance Rule

Configure the CheckNegativeBalance Rule
This rule simply suspends accounts whose balance goes negative, for obvious business reasons. When an account balance changes, this rule checks whether the the new balance is less than zero. If it is, the account is suspended.
Task J Configure the CheckNegativeBalance Rule
This task provides summary instructions for actions you have already learned. If you need a reminder, refer to Task H for details.
1.
2.
Open the rule editor for the CheckNegativeBalance rule.
3.
In the Declaration area, declare the Account concept.
4.
In the Conditions area, type the following:

 
//Checks that the balance is less than zero
account.Balance < 0;
//Checks that Account status is not set to Suspended
account.Status!="Suspended";

 
5.

 
account.Status="Suspended";
System.debugOut("############### Account ID <"+account@extId+"> STATUS set to <Suspended>. Balance <"+account.Balance+"> is less than zero");

 
6.
Click Apply and save the project.
Summary and Next Steps
You have now configured the project’s ontology and rules. Now you are ready to configure and build the archive, ready for deployment.