Creating a Validation Rule is one of the standard data-quality enforcement steps in any Salesforce implementation. The configuration is simple; the design decisions before configuration matter more.
- Open Setup and navigate to the object's Validation Rules
Setup > Object Manager > select the object > Validation Rules. The list shows every existing rule on the object with its Active flag.
- Click New
The New button at the top opens the rule editor. Pick a clear Rule Name (this shows up in error logs and Setup; it stays internal-facing).
- Write the formula
Use the formula editor to express the condition that should block the save. The formula must return true to block. Common starting points: ISBLANK(SomeField), Some_Field__c = "Bad Value", ISCHANGED(Status) && PRIORVALUE(Status) = "Closed".
- Set the error message and location
Write a message that tells the user what to fix. Set Error Location to Field (and pick the specific field) so the error displays inline; only use Top of Page when the rule applies to a combination of fields with no single offending input.
- Test with a sandbox record
Save a record that should pass the rule and confirm it saves; save a record that should fail and confirm the error fires with the expected message.
- Activate the rule
Toggle the Active checkbox to true and save. Activation makes the rule immediately effective on all subsequent record saves.
- Communicate the rule to affected teams
Before deploying to production, tell sales/service/operations teams what the new rule does so they can adjust their data-entry behavior.
- Validation Rules cap at 100 active per object. Audit quarterly and deactivate rules that no longer catch real violations.
- Profile-based bypasses are brittle; use Custom Permissions instead. Profile renaming breaks profile-based rules silently.
- Error Location matters. Inline field errors are far easier for users to act on than top-of-page errors.
- Validation Rules also fire on integration writes by default. Use $User.UserType or a Custom Permission to bypass for service accounts when needed.