Print this page

Disable or delete an Apex Class or Trigger from a Production Organization

Knowledge Article Number 000006188

An Apex Class or Trigger must be removed from a production instance if it's blocking a deployment or is no longer needed. Since Apex code can't be modified directly within a Production organization, so it requires steps using Developer tools, like the IDE

Important: This is the only way an Administrator or Developer can disable or remove Apex in Production.


Steps to Remove or Disable 

1. IDE should be installed.
2. Connect to the Sandbox Instance using the IDE and find the class or trigger that you want to delete.
3. Open the matching .xml file, and change the Status XML tag from Active to Deleted
4. Or to disable the trigger change it to Inactive.
Note: Apex class Status can only be changed to "Active" or "Deleted," not "Inactive".
5. Save the file.
6. Select the two files (Code and XML) using "Ctrl-click," and then right-click on one of them.
7. Select Force.comDeploy to server.
8. Provide your credentials for the Production org and follow the steps.

promote demote