Find your content:

Search form

You are here

Deleting a Class with IDE - cannot delete from Production?


When trying to delete a Class using IDE (simply right click and delete, and confirming I want it deleted in SF as well), it fails with the following screenshot. I have seen a couple posts via Google search that show people having this problem, but I'm not seeing a solution.

I am trying to cleanup. We have consolidated many classes (and triggers) into single classes/triggers, and now have old classes commented out with no code actually running - we'd like to remove them so our list of classes/triggers is clean/shorter.

Failed Delete in IDE

Trying the same in Sandbox: Worked fine. I tried deleting from Production AFTER deleting in Sandbox, and it still failed.

Attribution to: AMM

Possible Suggestion/Solution #1

You cannot delete a class in production directly. You will need delete the class from your sandbox and then deploy the deletions to your production org. When you deploy from sandbox to production, the missing classes will come up in red and you can choose to deploy these deletions to Production.

If there was a dependency on that class in another piece of code, you may have to deploy a version of that class or trigger with the dependency commented and then deploy the deletion.

If you are using the Migration tool, you can deploy the deletions using destructiveChanges.xml

Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content