I hope everyone had a great weekend. I had a little too much fun with my “Wife” on Saturday at a music festival and didn’t get as much design work done as I would have liked this weekend. That being said, it didn’t prevent me from writing this post regarding validation rules. This is a brief step in overall object development but very important for insuring the use of correct values and data.
Validation rules are great additions to your objects due to the fact they go beyond the simple required/not required field selections. These rules are formula based and prevent the end users from saving an object if the formula elevates to true. Your custom error message will be displayed below the field in question when the validation rule actual prevents the saving of data. We need to add two validation rules to our Scheduled Invoice object.
The first rule will prevent creation of invoices with a ‘Total Amount’ less than one, and the second rule prevents users from changing terms after the invoice has been established. To complete this we need to start at the Custom Object Definition Screen. Begin by scrolling down to the ‘Validation Rules’ section and clicking ‘Next’. Set the ‘Rule Name’ to the following:
"Disallow_Amounts_Less_Than_One"
Once set, check the ‘Active’ box. Set the ‘Error Message’ to the following:
“The Total Amount Due must be greater than 1”
Following this step change the error location to the ‘Total Amount Due’ field.
The developer has two options when defining the validation formula. You can either type the formula by hand or utilize the buttons around the formula editor. Our particular validation rule is only going to check to see if the ‘Total Amount Due’ is less than one. To reference the ‘Total Amount Due’ field, you can either type in the API name of the field or use the "Insert Field" button to select the field.
These rules, once established, prevent what could be potentially damaging fiscal errors for our Scheduled Invoice object. Next post we will begin using the page layout editor in order to drag and drop fields within sections. Please try to contain your excitement until then.
No comments:
Post a Comment