Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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 Force.com Migration tool, you can deploy the deletions using destructiveChanges.xml

share|improve this answer
    
WHOA. I was not aware of that. Going to try that ASAP. Makes sense given the Sandbox-Production relationship... –  AMM Dec 20 '12 at 14:51
    
Great. Since I test deleted a class in Sandbox using IDE, it's not showing up as a delete-available class for deployment now (so I'm guessing it's stuck in Production forever unless simply creating a new class by the same name fixes it- I'll try that). –  AMM Dec 20 '12 at 14:55
1  
Have you tried deploying the entire classes folder to production after carrying out the deletion? Eclipse should figure out the differences between the two folders. –  Bob Buzzard Dec 20 '12 at 15:14
    
@techtrekker , deleting the Class in Sandbox does nothing except delete it. It does not show up in the list of classes (red or otherwise) :-( –  AMM Dec 20 '12 at 20:17
    
@BobBuzzard , no, since I cannot delete in Production anyway, but I will try now.... did not work. I deleted the class in IDE, then on the Classes folder, right click, Force.com, Save To Server, no change. (though it "succeeded" in it's Save supposedly). –  AMM Dec 20 '12 at 20:21
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.