function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Abhishek KedariAbhishek Kedari 

How to remove validation errors from production

    I wrote some Apex code in sandbox and now I want to deploy it on production server.
    But there are some rules defined on production because of which some of test cases in production gets failed. Nothing related to my code.
    Now because of those errors I can not check in my code on production. So I need to fix those errors first. Can anyone please help me with this?
    Solutions I tried :
    1. Modify test class file in sandbox (which throws validation error) and tried to update it on production, but iits not allowing me to deploy any code on production because it executes those test cases and tells me that validation error exist on production server.
   2. Disabled that validation rule on production, but still got same error.

Please help me with this.

Shashikant SharmaShashikant Sharma
Best way is to copy the validation rule in Sandbox, make sure you get same expection in sandbox. Fix the issue and deploy the test methods to production. 

Alternative is to disable the validation rule. Run the failing test classes individually and see if they run fine. If they run then deploy your code and enable the validation rule. You mentioned that you tried this, just make sure once you disabled one validation rule some other validation rule did not made it fail.