– An Apex class or trigger must be removed from a production instance if it is blocking a deployment or is no longer needed.
– Apex code may not be modified directly within a Production org, so it requires a couple of steps using Developer tools.
– This article gives instructions using the Force.com IDE
– This is the only way an Administrator or Developer can disable or remove Apex in a Production org.
– 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.
Below are the steps:
1) From Force.com IDE, select the class that you want to delete (Look for .xml extension )
2) Open that .xml version of your class and change the Status tag to Deleted.
3) Right click and save the file.
4) Now select \”SRC\” folder and right click—>Select Force.com—> select Deploy to server
5) Log into your production org and follow the steps.
Note: if you have any test class for the class that you are deleting make sure you do the same like above and then select those 2 classes for final deployment.