How to Create a Validation Rule in Salesforce
Validation rules act as roadblocks to ensure data accuracy in Salesforce. Here's how to create one:
- Go to Setup on the top right.
- Search for Object Manager in the Quick Find.
- Select the object you want to enforce the rule on (Leads, Opportunities etc).
- Find the Validation Rules section and click on it.
- Click New to initiate the creation of a new validation rule.
- Define the Rule:
- Label: Give your rule a clear name (e.g., "Opportunity Requires Amount").
- Select "Active" to make the rule enforceable.
- Error Condition Formula: This is the key part. Use the formula builder to define the criteria that must be met to avoid an error message.
- Example Formula: ISPICKVAL(PRIORVALUE(StageName), "Closed Won") && Amount == null (Ensures amount is filled for opportunities marked as "Closed Won").
- Error Message: Craft a clear message displayed to users when the validation fails (e.g., "Please enter an amount for Closed Won opportunities").
- Click Save to create the validation rule.
This website uses cookies to ensure you get the best experience on our website. Learn More
Got it