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
Chad MoutesChad Moutes 

Deleting Apex Class Issue

Hello All,

I am trying to delete an Apex Class, and its associated Test Class from my production instance. I am changing the status to Deleted and then doing the deploy to server from IDE. But it is failing due to code coverage issues, but the only class/trigger that is less than 75% CC is the class that I am trying to delete. Am I missing something?

Any and all help would be greatly appreciated.
Hi Chad,

In this case it would not allow you to delete the class which is having less code coverage.Either you have to move this class to Sandbox and then increase the code coverage and then push it to Sandbox and then perform Delete.

Another way of deleting the Classes is by making use of Workbench:

1)Go to Migration - retrieve - Click on Unpackaged Manifest(Choose File Button) - (Below XML file should be Prepared and should be selected in this case)

Create a sample Xml file of the below format :
<?xml version="1.0" encoding="UTF-8"?>
-<Package xmlns="">
<members>(It should consists of your class name you wanted to delete)</members>

2)It downloads an unpackaged Zip file.
3)Unzip the file and there would be a xml file named Your Classname.cls-meta.xml
4)Open the XML file.Change the Status to deleted.Save it
5)Zip the same file with the changed status
6)Go to Workbench - Migration - Deploy - Select the created Zipped Package

Do let me know, if it worked for you.


Chad MoutesChad Moutes

Thank you for your response. I definitely think that would work for me. But I actually decided to just comment out the classes instead of deleitng them for now. Thanks again though.