Friday, December 21, 2012

Delete Triggers and Classes from Production in Salesforce using Eclipse IDE

In order to remove a class or trigger from production using the force.com ide you can do the following:

1. Pull up the XML file associated to the class/trigger, it will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>21.0</apiVersion>
    <packageVersions>
        <majorNumber>1</majorNumber>
        <minorNumber>3</minorNumber>
        <namespace>households</namespace>
    </packageVersions>
    <status>Active</status>
</ApexClass>
2. Where is says <status> replace "Active" with either "Inactive" or "Deleted" then save the XML.
3. Now deploy this class/trigger to production and it will be removed!