Active validation rules in the target org are a frequent cause of FIELD_CUSTOM_VALIDATION_EXCEPTION errors in data deployments. Sometimes it's just not possible to update your existing records so that they conform to your new validation rules.

Active triggers in the target can cause System.LimitException: Apex CPU time limit exceeded if they fire on lots of records in your deployment. Any unhandled exceptions thrown by triggers will also cause deployments to fail.

Active flows and process builders in the target org can also cause errors during data deployments, such as CANNOT_EXECUTE_FLOW_TRIGGER: We can't save this record because the process failed.

One of the ways you can avoid these types of error is to disable the validation rules, triggers and flows before you run the deployment. Gearset can help you do that without the need to navigate away to your org.

Click the View and disable rules... button in the bottom-right of the pre-deployment summary page (next to DEPLOY DATA) to prepare a special metadata comparison.

The comparison might take several minutes to prepare:

Once it's ready, you'll be able to view the comparison. (It'll open in a new tab.)

Choose which rules and triggers you want to disable and then deploy your chosen items just like a normal metadata deployment. (Note: these will not include manage package metadata triggers or validation rules.)

To disable flows, choose and deploy the corresponding flow definitions.

Once you've finished your data deployment, you can re-enable the rules, triggers and flows by rolling back the metadata deployment via the deployment history:

Rollback is usually an Enterprise feature, but this special type of deployment can be rolled back by anyone with a Pro or Enterprise license.

Did this answer your question?