+ Start a Discussion
b.gonzalezb.gonzalez 

Not able to delete Apex Class from production using Force.com IDE?

I performed the following steps to delete Apex Class from production using Force.com IDE, however I am not able to deploy to the server? The button is greyed out. What am I doing wrong? Did I miss a step?

- Force.com IDE should be installed and working.
- Connect to the Productio Instance using the IDE.
- Created a project and select the apex class and trigger I want to delete. 
- Open the matching .xml file change the Status XML tag from "Active" to "Deleted".
- Save the file locally. 

User-added image
Beth
 
James LoghryJames Loghry
That flag itself is not writeable.  You'll need to add the deletions to a file called destructiveChanges.xml and propogate it using either the Force.com IDE or Migration Toolkit.  See here for more info: https://developer.salesforce.com/page/Propagating_Destructive_Changes  (https://developer.salesforce.com/page/Propagating_Destructive_Changes)
Amit Chaudhary 8Amit Chaudhary 8
Hi b.gonzalez,

Please follow below step that will help you :-
- Force.com IDE should be installed and working.
- Connect to the Sandbox Instance using the IDE and find the class or trigger that you want to delete.
- Open the matching .xml file change the Status XML tag from "Active" to "Deleted" if you want to remove the trigger or class, or to "Inactive" if you want to disable the trigger.
- Apex class Status can only be changed to "Active" or "Deleted", not "Inactive".
- Save the file.
- Select the two files (Code and XML) using Ctrl-click, then right click on one of them. Select Force.com > Deploy to server.
- Provide your credentials for the production org and follow the steps.


https://help.salesforce.com/apex/HTViewSolution?id=000006188
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008yIyIAI

Please let us know if this will help you.

Thanks
Amit Chaudhary