All Collections
Data seeding/ restoration
Data seeding/ restoration
Resolving data deployment errors: FIELD_CUSTOM_VALIDATION_EXCEPTION
Resolving data deployment errors: FIELD_CUSTOM_VALIDATION_EXCEPTION

This article explains when and why the FIELD_CUSTOM_VALIDATION_EXCEPTION error occurs, and how to fix it

David Runciman avatar
Written by David Runciman
Updated over a week ago

The FIELD_CUSTOM_VALIDATION_EXCEPTION error can occur during a data deployment if you have added a new custom validation rule or an Apex trigger in your target org. 

What causes the error?

Gearset’s data loader will throw this error when you try to deploy records in the source org that fail a custom validation rule or trigger an error by calling the addError() method in your target org. When you add a new validation rule or a trigger to your orgs, Salesforce doesn’t check that all of your existing data complies with the new rule. For instance, you might have added a custom validation rule to both your source and target orgs before attempting to deploy records that fail the new rule. The error then occurs because Gearset cannot insert these invalid records into the target.

How do I fix the error?

The straightforward way of avoiding this error is to disable the custom validation rule or Apex trigger in your target org before running the deployment. Gearset can help with that. A more general piece of advice is to check that a new validation rule or trigger is valid for your existing data before adding it to your org. Alternatively, for the purpose of the deployment, you may choose to filter and exclude the record(s) that give rise to the error.

Did this answer your question?