Validation formula field restrictions
Key Takeaway
A validation rule formula can't reference compound fields, auto number fields, or campaign statistic fields. For compound fields, you can still reference an individual part of an address, such as Billing City, or use the field inside ISNULL, ISBLANK, or ISCHANGED.
A validation rule uses a formula to check the data a user enters before the record can be saved. When the data is invalid, the formula returns True, and the user sees the rule's error message. Not every field can appear in that formula, so an app builder needs to know which fields are off-limits and which workarounds are allowed.
Merge fields in a validation rule formula
A validation rule formula reads values from the record through merge fields. The syntax is the object, a period, and the field name. For example, $User.State corresponds to a user's state or province.
Merge field syntax can vary depending on where you use the field. Select merge fields from the drop-down list in the formula editor to make sure the syntax is correct. The merge fields for validation rules match the fields in your app.
If two or more custom objects have matching names or labels, only one of them appears when you select merge fields. Give every custom object a unique name and label so you can select merge fields from any of them.
You can apply different validations to different record types with the RecordType.Id merge field in the formula.