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
Mike Davis 43Mike Davis 43 

Code Coverage error when deploying Change Set

I'm a new administrator to my company's Salesforce org.  There are many triggers that were written years ago that are no longer needed.  I'm trying to deploy a change set from Sandbox to Production-the Change Set is simply deactivating those triggers.

When deploying, however it the validation fails due to code coverage errors.  We can honestly delete any and all APEX Classes and Triggers in our org.  That said-I have no clue as to the best way to do this.  I can delete the APEX classes in Sandbox and I can deactivate the APEX Triggers in Sandbox.  But if I try to deploy a change set to Production to deactivate the APEX triggers, it errors out.  Is there a simpler way for a layman such as myself to do this?

As an example:
When I validate the Change Set, it fails. It says the following:
***************************************************************************
Code Coverage Failure
Your organization's code coverage is 30%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
APX_Group_Set_Up_Task
Advisor_Channel_Data_Update_Task
APX_Reporting_Group_Follow_Up_Task_2
UpdateRegistration
NMTNotesDeletionTrigger
 
Manj_SFDCManj_SFDC
Hi Mike, 
you can do try to follow these

1) Need to modify te test classes for existing triggers ( not feasible in your case, since you do not need those triggers and classes)

2) via Force.com IDE,
Disable the trigger in sandbox environment [You should have a sandbox org which contains the same trigger]
Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
1. Alternative: edit the triggername.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
2. Save the change locally Deploy the trigger to production
Complete the data load
If the change is not permanent or you want to enable the trigger again then enable the trigger by making it active on the sandbox or project again and deploy it to production

3) via Changesets,
Disable the trigger in a Sandbox environment [You should have a Sandbox org which contains the same trigger]
Create a new Outbound Change Set in the Sandbox
Add the disabled trigger to the Change Set
Upload the Change Set to your Production Org
In Production, go to Inbound Change Sets and wait for the uploaded Change Set to be available
Click Deploy to run the tests and apply the changes

please refer this too, 

https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/

Mark this as solved if this helps you
 
Manj_SFDCManj_SFDC
http://www.salesforceben.com/way-to-delete-apex-classes-from-production/