Validation rules verify that the data a user enters in a record meets the standards you specify before the user can save the record. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False”. Validation rules also include an error message to display to the user when the rule returns a value of “True” due to an invalid value. example:
If my answer was helpful to you please mark it as best answer/solved.
Introduction to Validation Rules Validation rules verify that data entered by users in records meet the standards you specify before they can save it. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False.” Validation rules can also include error messages to display to users when they enter invalid values based on specified criteria. Using these rules effectively contributes to quality data. For example, you can ensure that all phone number fields contain a specified format or that discounts applied to certain products never exceed a defined percentage.
Creating a Validation Rule 1) Navigate to Customize | Your Object | Fields | Your Selected Field (such as Account Name), and under Validation Rules, click New. 2) Enter the following properties for your validation rule:
3) To check your formula for errors, click Check Syntax. 4) Click Save to finish.
example:
If my answer was helpful to you please mark it as best answer/solved.
Thank you,
Esther Onema.
I will recommend you to start learning salesforce with trailhead
1) https://developer.salesforce.com/trailhead/module/point_click_business_logic
Introduction to Validation Rules
Validation rules verify that data entered by users in records meet the standards you specify before they can save it. A validation rule can contain a formula or expression that evaluates the data in one or more fields and returns a value of “True” or “False.” Validation rules can also include error messages to display to users when they enter invalid values based on specified criteria. Using these rules effectively contributes to quality data. For example, you can ensure that all phone number fields contain a specified format or that discounts applied to certain products never exceed a defined percentage.
Creating a Validation Rule
1) Navigate to Customize | Your Object | Fields | Your Selected Field (such as Account Name), and under Validation Rules, click New.
2) Enter the following properties for your validation rule:
3) To check your formula for errors, click Check Syntax.
4) Click Save to finish.
Please check below post for example
1) https://developer.salesforce.com/trailhead/point_click_business_logic/validation_rules
Let us know if this will help you