Quick summary
Salesforce validation rules enforce data quality checks by blocking record saves when required fields or conditions are not met. This step-by-step walkthrough shows how to create a validation rule on any object using the Object Manager and a custom Error Condition Formula.
Steps
- Go to Setup on the top right of Salesforce.
- Search for Object Manager in the Quick Find box.
- Select the object you want to enforce the rule on, such as Leads or Opportunities.
- Find the Validation Rules section and click on it.
- Click New to initiate the creation of a new validation rule.
- Define the rule Label and Error Condition Formula settings.
- Enter a clear rule Label, for example "Opportunity Requires Amount".
- Select Active to make the rule enforceable immediately.
- Craft a clear Error Message displayed to users when validation fails, for example "Please enter an amount for Closed Won opportunities".
- Enter the Error Condition Formula using the formula builder to define the criteria, for example ISPICKVAL(PRIORVALUE(StageName), "Closed Won") && Amount == null.
- Click Save to create and activate the validation rule.
.gif)
