Delete Apex Classes From Production
Deploy Destructive Changes
Removing dead code is an important aspect of software development that is often being neglected. In the world of Salesforce and Apex development, removing dead code not only promotes a cleaner code base but also improves test coverage and help reduce deployment time.
Compared to other software development stacks, deleting Salesforce Apex code isn’t as trivial. Today, most developers use a combination of Ant or Eclipse IDE with manual editing of XML files to get the job done. In this blog post, we show you how simple it is to delete Apex classes, triggers and other metadata components using ClickDeploy.io
Destructive Deploy Options
When you create a new deployment, the Deploy Type option is defaulted to “Standard”. To deploy destructive changes, change Deploy Type option to “Destructive”. This indicates that the deployment will delete components selected in the “Component Selected” tab.
Note that in a destructive deployment, the source organization is no longer relevant. When you select components to add to a destructive deployment, the system lists all components available in the target org.
Once you are ready to proceed, click “Validate” or “Deploy” as you normally would in a standard deployment.
Test level and validation behaviours
Similar to standard deployments, test level and validation behaviors are also applied to destructive deployments.
When you deploy destructive changes to production, Salesforce does compilation checks to ensure that the classes being deleted are not referenced by any other metadata components. Code coverage requirement is also enforced as usual.
Are you still using change sets ? Try clickdeploy.io today and deploy Salesforce 10x faster.