When you create custom fields and page layouts, you can mark fields as required. You may want to set other types of rules for your records before they can be saved.
With object validation rules, administrators can write formulas to verify that certain conditions are met before records are saved. You can create validation rules for all standard and custom objects.
Like calculated fields, formulas are written using C# (C sharp) and must return a Boolean value (true or false). If you're not familiar with C# or any C programming language, get assistance from someone who is.
You can write your formula using if-else statements, but your statements cannot contain:
- for loops
- do while loops
- method declarations
The formula below is an example of an if-else statement.
According to this if-else statement, the first name field for a contact record cannot be equal to the word test. You can create custom error messages when rules are not met, such as letting users know that "test" is not a valid entry for the first name field.