Cert++
Close

Validation rule error-condition formulas

Key Takeaway

Write the formula to describe the bad data you want to block, not the good data you want to allow. When the formula returns TRUE, Salesforce does not save the record.

A validation rule's error-condition formula is a formula that Salesforce checks every time someone saves a record. It evaluates data in one or more fields and returns TRUE or FALSE, and that result decides whether the record saves.

Write the formula as the situation you want to prevent

If the formula returns TRUE...

Salesforce does not save the record. The user sees the rule's error message.

If the formula returns FALSE...

The record saves.

You can choose the error location, which is where the message appears: next to a field or at the top of the page.

Because TRUE means the data is invalid, write the formula as the situation you want to prevent. For example, CloseDate < TODAY() flags any Close Date earlier than today.

The formula only has to return TRUE or FALSE, so do not wrap it in IF(condition, TRUE, FALSE). CloseDate < TODAY() is the correct form, and IF(CloseDate < TODAY(), TRUE, FALSE) is the incorrect form.

Platform App Builder Study Guide

Checklist progress

0/340Learned

Given a scenario, demonstrate the use of validation rules to meet stated business requirements

0/15

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Platform App Builder studiers. 757 members and growing.