Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Full Validation Rule entry
How-to guide

How to create a Validation Rule

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.

By Dipojjal Chakrabarti · Founder & Editor, Salesforce DictionaryLast updated May 16, 2026

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.

  1. 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.

  2. 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).

  3. 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".

  4. 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.

  5. 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.

  6. Activate the rule

    Toggle the Active checkbox to true and save. Activation makes the rule immediately effective on all subsequent record saves.

  7. 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.

Gotchas
  • 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.

See the full Validation Rule entry

Validation Rule includes the definition, worked example, deep dive, related terms, and a quiz.