FIELD_CUSTOM_VALIDATION_EXCEPTION in Salesforce: what it means and how to fix it
Short answer: FIELD_CUSTOM_VALIDATION_EXCEPTION means the record broke a custom rule in the target org: a validation rule's formula evaluated to true, or an Apex trigger called addError(). The text after the code is that rule's own error message, which is your best clue to which rule fired.
Validation rules are formulas an admin attaches to an object. When a record is saved, Salesforce evaluates each active rule, and if a formula returns true the save is rejected with the rule's error message. Apex triggers can reject a record the same way by calling addError(). Either way the API reports:
FIELD_CUSTOM_VALIDATION_EXCEPTION: Close Date can't be in the past: [CloseDate]
The part after the code is written by whoever built the rule, and the bracketed field, when present, is the field the error was attached to.
Why it happens
- Business rules written for people, not loads. Rules such as "Close Date can't be in the past" or "Phone is required when Stage is Negotiation" make sense for users entering data, but historical or copied records break them routinely.
- Rules that differ between orgs. A sandbox can have rules that production doesn't, or newer versions of them, so records that are valid in the source fail in the target.
- Cross-object rules. Rules that reference parent fields fail when a parent field is blank or hasn't been loaded yet.
- Trigger logic. An Apex trigger checks a condition and calls
addError(), for example to block duplicate names or enforce a status transition.
How to fix it
- Find the rule. Search the object's validation rules for the message text. If nothing matches, search the object's Apex triggers for the same text.
- Fix the data if the rule is right. Fill the missing field, correct the date, or load the parent first so cross-object references are populated.
- Add a bypass for loads. Create a custom permission such as
Bypass_Validation, give it to the integration user with a permission set, and addNOT($Permission.Bypass_Validation)to each rule's formula. - Deactivate temporarily in a sandbox. For a one-off load into a sandbox, deactivate the rules on the objects you're loading and reactivate them as soon as the load completes.
- For triggers, add a bypass check in the trigger handler (for example a custom permission or custom setting), since deactivating validation rules doesn't affect Apex.
How Syntharil handles it
Syntharil treats this as a schema or configuration error: the fix lives in the target org's rules or in the job setup, not in regenerating values. It doesn't switch off validation rules or Apex triggers in your target org; they run on every record it loads, exactly as they would for any other integration. Rows a rule rejects are reported individually with Salesforce's own message, including the rule's error text and field, while the rest of the batch continues, so you can find the rule and decide whether to fix the data, add a bypass permission for the user Syntharil connects as, or deactivate the rule in that sandbox before the next run.
FAQ
How do I find which validation rule fired?
Copy the message text after the error code and look for it in Setup, Object Manager, the object's Validation Rules list. Each rule has an error message, and the one that matches is the rule that rejected the record.
Is it safe to deactivate validation rules during a data load?
In a sandbox you control, deactivating rules for the duration of a load and reactivating them afterwards is common. In production it's risky, because users can save bad data while the rules are off. A bypass permission for the integration user is safer there.
How do I bypass a validation rule for one user?
Create a custom permission, assign it to the integration user through a permission set, and add NOT($Permission.Your_Permission_Name) to the rule's formula so the rule never fires for that user.
Why does the error appear when no validation rule exists?
Apex triggers that call addError() on a record produce the same error code. If no validation rule matches the message, search the object's triggers for the message text.