Salesforce glossary

Validation rule

A Salesforce validation rule is a formula attached to an object that checks a record before it is saved. When the formula evaluates to true, the data is considered invalid: the save is refused and the user sees the rule's error message, either next to a field or at the top of the page.

How a validation rule works

The rule's formula returns true or false. True means the record breaks the rule. Functions such as ISNEW and ISCHANGED let a rule apply only on creation or only when a given field changes. The rule applies to new and updated records even when the fields it references are not on the page layout or not in the API call.

When one rule fails, Salesforce keeps evaluating the others and returns all the error messages together.

Where it runs in the save

Custom validation rules run after the before-save flows and the before Apex triggers, together with the second pass of system validation. A value set by a before trigger is therefore validated; a value set later by a workflow field update is not, because validation rules are not re-run at that step.

Where it is not enforced

Salesforce lists contexts where validation rules do not run, including records created with Quick Create, ownership changes made with the Mass Transfer tool, workflow field updates, and lead conversion unless the org has enabled validation and triggers for lead conversion. A rule is a strong guard on user and API edits, not an absolute guarantee about the data.

Why validation rules matter for documentation

Validation rules often encode the business rules an organisation actually enforces — a discount cap, a mandatory field at a given stage. Their formulas say it precisely but not readably, and the error message rarely says why the rule exists.

Where aprity fits

How aprity helps

aprity reads each validation rule from the metadata and documents it per object in business language — what it blocks and when — with the rule linked to the component it was read from. The per-object execution graph shows where it sits among the other automation on the save, and the business-language diff between scans shows when a rule was added, changed or removed.

Related terms

  • Salesforce order of execution — The fixed sequence in which Salesforce runs flows, triggers, validation rules and other automation when a record is saved.
  • Apex trigger — Apex code that runs automatically before or after records of an object are inserted, updated, deleted or undeleted.
  • Salesforce technical debt — The accumulated cost of past configuration and code shortcuts in a Salesforce org that makes every future change slower and riskier.

All Salesforce glossary terms →

Sources

Official Salesforce documentation this entry was checked against. Platform behaviour changes between releases; the linked page is the reference.