Skip to content
StackDecode
IntermediateLesson 12 of 37

Validation rules and formulas

Enforce data quality and compute values.

A validation rule blocks saving when a formula evaluates to TRUE, and shows an error message.

text
AND(
  ISPICKVAL(StageName, "Closed Won"),
  Amount <= 0
)

Error message: "Closed Won opportunities need an Amount greater than zero."

Formula fields compute read-only values: Amount * 0.1, IF(Amount > 100000, "Large", "Small"), TEXT(CloseDate), cross-object Account.Industry. Formulas have a compile-size limit, and roll-up summary fields aggregate child records (Master-Detail only).