Today’s business is data driven – that’s probably one of the many reasons you have implemented Cloud Coach and Salesforce in your organization. The ability to report on, segment and view your business data in hundreds, if not thousands of ways provides power and flexibility. Of course, your ability to put this data to use in your business is only as good as the data itself – which is why data validation rules are important. You’ll save yourself (and your team) hours of time by ensuring data is entered correctly the first time.
Validation Rules help you improve the quality of your data by verifying that the data entered by a user meets the standards you specify. If the data doesn’t meet your specifications, then the user cannot save their changes to the record.
A validation rule is simply a formula with a true or false outcome. This true/false outcome determines whether the record can be saved or not. When the formula evaluates to true, the data is bad/incorrect and we cannot allow the user to save the record. When the formula evaluates to false, the data is good/correct and the user can save the record. (Be sure you note this – if your rule = TRUE, then the record cannot be saved. This may be opposite to the logic than you expect in this instance.)
When you create a validation rule, we recommend you include an error message for your user in case their changes are not saved. This error message can be either at the top of the page, or beside the field. With the custom text you add to the message, you should let the customer know what they need to do in order to save their changes.
Creating a New Validation Rule
In this example we are going to use a simple Budget field to store the Cloud Coach Project budget amount. Once the Project contract has been signed, users should not be able to change the budget field. To prevent this field value from being reduced we will create a validation rule.
To create a validation rule, navigate to the Setup area.
For standard objects such as Accounts and Opportunities: Customize > Accounts > Validation Rules
For custom objects you have created or installed: Create > Objects > Object Name > Validation Rules
Create a new rule by clicking New and giving your rule a name. We will call our rule Budget Can’t Reduce When Contract Signed. Enter a description and ensure the Active box is checked.
From here we need to enter the Error Condition Formula.
– A TRUE outcome means the record cannot be saved, as the data is incorrect
– A FALSE outcome means that the record can be saved, as the data is correct
Our formula must contain a reference to both the Budget field and the Contract Status field. Use Insert Field, Insert Operator, and Functions to add fields and formula elements to your Error Condition Formula.
Our rule shown below states that if the Contract Status equals ‘Signed’ and the prior value of the Budget field is greater than the new value on the Budget field then our formula will evaluate to true.
Once you have entered your formula you can confirm there are no errors by clicking Check Syntax.
You should also enter an error message that will be displayed to the user when the record cannot be saved, the message can either appear at the top of the page or beside the field that is causing the error.
Testing Your New Validation Rule
You should always test your validation rule to ensure it works the way you intended. As you can see, the Contract Status is ‘Signed’. When we attempted to reduce the Budget from $50,000 to $30,000, we received the error message below.
When dealing with a lot of information in Cloud Coach, it is beneficial to have validation rules in place to ensure the data is correct rather than having users looking through reports to ensure the information entered is as it should be. Validation rules help you maintain data integrity and prevent any changes that should not be made.
Validation rules are a great way to improve the quality of your data. Try creating one for yourself!