Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
DictionaryVValidation Rule
AdministrationIntermediate

Validation Rule

A Validation Rule in Salesforce is a formula-based rule that prevents users from saving a record if certain conditions are not met.

§ 01

Definition

A Validation Rule in Salesforce is a formula-based rule that prevents users from saving a record if certain conditions are not met. Validation Rules enforce data quality by checking field values against specified criteria and displaying an error message when the data does not comply.

§ 02

In plain English

👋 Study buddy

Here's a simple way to think about it: Validation Rules are how the platform refuses to save bad data. A formula evaluates on save; if it returns true, the platform blocks with your error message. Required fields, format checks, cross-field rules - all expressible declaratively.

§ 03

Worked example

scenario · real-world use

The admin at Cascade Logistics creates a Validation Rule on the Opportunity object that prevents reps from moving a deal to "Closed Won" unless the Amount is greater than zero and a signed contract has been attached. If a rep tries to close a deal without these, they see the error: "A signed contract and a positive amount are required to close this deal."

§ 04

Why Validation Rules are how the platform refuses to save bad data

A Validation Rule is a formula attached to an object that runs on save. If the formula evaluates to true, the platform blocks the save with the error message you defined. This is how data quality gets enforced declaratively in Salesforce - no Apex needed, no custom logic, just a formula that catches bad data before it lands in the database. Required fields, format checks, conditional requirements, business-rule enforcement - all expressible as Validation Rules.

The reason they earn careful design is that they affect every save path - UI, API, automation, integration, mass updates - without exception. A Validation Rule that's correct for one path may be too strict for another (a rep entering a record manually vs. an integration loading historical data); a rule that's too permissive lets bad data through every path. Build rules that express genuine data invariants, document them clearly so users know why the save failed, and audit the catalog as the org evolves - old rules can become quietly wrong as business processes change.

§ 05

How to set up Validation Rule

Validation Rules block a save when their formula evaluates to TRUE — they're the platform's first line of defense against bad data. Setup lives under Object Manager, one rule at a time, scoped to a single object.

  1. Open Setup → Object Manager

    Top-right gear icon → Setup → Object Manager. Pick the object you want to validate (Account, Contact, custom — anything).

  2. Open the Validation Rules section

    From the object's left rail, click Validation Rules.

  3. Click New

    Top-right. Each rule is an independent record.

  4. Name and describe the rule

    Rule Name is API-safe (no spaces). Description is for fellow admins — explain *why*, not just *what*, because the formula will tell anyone what.

  5. Build the Error Condition Formula

    The formula must return TRUE when the data is *bad*. The Insert Field and Insert Operator buttons help you build it without typos.

  6. Set the Error Message and Location

    The message shown to the user when the rule blocks save. Location is either "Top of Page" or a specific field — field-level errors are more helpful.

  7. Activate

    Tick the Active checkbox at the top before saving the rule. Inactive rules don't fire.

Key options
Error Condition Formularemember

The Boolean formula. Returns TRUE → block save. The single most-confused part of validation rules — TRUE means "reject", not "accept".

Error Locationremember

"Top of Page" puts the message above the page-level error banner; "Field" attaches it inline next to the offending field. Field-level is friendlier when the rule is field-specific.

Activeremember

On = enforced; Off = saved but ignored. Useful for staging fixes before flipping the switch in production.

Gotchas
  • Validation rules fire on UI saves *and* on every API/Apex/Flow DML — a rule designed for the screen can break a nightly integration. Test against your bulk loads.
  • TRUE = reject is the inverse of what most people guess. Sanity-check by reading the formula as "reject when ___" out loud.
  • Validation rules run *after* before-save Flows and triggers but *before* after-save logic — a Flow that fixes the data still has to satisfy the rule on the saved record.
§ 06

How organizations use Validation Rule

Vanguard Solutions

Validation rules enforce contract-required fields before opportunity close; deal records are complete by definition.

BlueRiver Health

HIPAA-relevant patient data validation prevents incomplete records; data integrity is platform-enforced.

§

Trust & references

Official documentation

Straight from the source - Salesforce's reference material on Validation Rule.

Was this entry helpful?
Help us write better definitions. Quick reactions or detailed edit suggestions.
§

Test your knowledge

Q1. Why is understanding Validation Rule important for Salesforce admins?

Q2. In which area of Salesforce would you typically find Validation Rule?

Q3. Can a Salesforce admin configure Validation Rule without writing code?

§

Discussion

Loading…

Loading discussion…