FIELD_CUSTOM_VALIDATION_EXCEPTION: meaning and how to fix it

Data and DML Checked against the official docs on Source: SOAP API Developer Guide: Core Data Types, StatusCode

Quick answer

FIELD_CUSTOM_VALIDATION_EXCEPTION: A validation rule on the object evaluated to true, so Salesforce blocked the save. The text after the code is the error message of that rule, and the field in brackets is where the rule shows the error. Start with: Read the message after the code: it is the rule's own error message.

Typical message: FIELD_CUSTOM_VALIDATION_EXCEPTION, Amount must be positive: [Amount]

Cause

A validation rule on the object evaluated to true, so Salesforce blocked the save. The text after the code is the error message of that rule, and the field in brackets is where the rule shows the error.

How to fix FIELD_CUSTOM_VALIDATION_EXCEPTION

  1. Read the message after the code: it is the rule's own error message.
  2. In Setup, open Object Manager, the object, then Validation Rules, and find the rule with that message.
  3. Fix the data so the rule passes, or correct the rule formula if it is wrong.
  4. In Apex, catch DmlException and use getDmlMessage(0) to show the rule message to the user.

Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.

Frequently asked questions

What does FIELD_CUSTOM_VALIDATION_EXCEPTION mean in Salesforce?

A validation rule on the object evaluated to true, so Salesforce blocked the save. The text after the code is the error message of that rule, and the field in brackets is where the rule shows the error.

How do I fix FIELD_CUSTOM_VALIDATION_EXCEPTION?

1. Read the message after the code: it is the rule's own error message. 2. In Setup, open Object Manager, the object, then Validation Rules, and find the rule with that message. 3. Fix the data so the rule passes, or correct the rule formula if it is wrong. 4. In Apex, catch DmlException and use getDmlMessage(0) to show the rule message to the user.

More Data and DML errors

SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.