I cannot install Eclipse, even if I wanted to. It is not approved software for my org.

How can test classes be deleted from production, using deployments? There no 'active' checkbox when I am editing the classes in sandbox mode, so I can't just deactivate the test class, and i cant deploy a deleted class to prod... how the heck is this done?

I dont want to use ANT or special software. SF must have a native way to achieve this. And if not... then I am very disappointed in humanity.

  • 3
    lols one easy way is to comment out using /* at the start and */ at the end of the class, there by commenting out the complete class and deploy it using change sets (standard deploy mechanism provided by salesforce). Wish someone comes up with something better, but for now I am sure this solution should restore your faith in humanity :D
    – Rao
    Commented Aug 11, 2014 at 21:03
  • Heh yeah that's what I ended up doing. Well actually i deleted all the contents of the test method for now. I found a knowledge article stating that IDE is the only way to fully delete them. Commented Aug 11, 2014 at 21:14
  • 1
    @DownstairsB There's multiple ways to achieve your goals. You might want to revisit this question.
    – sfdcfox
    Commented Aug 11, 2014 at 21:59

4 Answers 4


You can do this with only the software that comes installed with Windows/Linux/Mac. These instructions will be for Windows.

Create a Folder

Make a folder on your desktop. You'll want this so you can keep your files in order.

Create package.xml

Open Notepad (Start > Accessories > Notepad). Copy the following text into the text editor:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

Save this file as package.xml within the folder you created. NOTE: You have to change "Save as type" to "All files (*.*)", or Notepad will "helpfully" add a ".txt" extension that we don't want.

Create destructiveChanges.xml

Create a new file in Notepad (File > New). Copy the following text into your text editor:

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

Change SomeTestClass to the class you want to delete.

Save this file in the folder you created as destructiveChanges.xml (note the capital C in "changes"). Again, make sure that you saved it as "All files (*.*)".

At this point, you have two files in your folder. Open the folder, select both XML files, right-click, and choose "Send To > Compressed Folder". The default name is fine.

You're all set up at this point. Now, you just need to deploy the file.

Go to http://workbench.developerforce.com/, login using your production credentials, then choose "Migration > Deploy", upload your file, and confirm the process.

See this article (not mine: http://carvingintheclouds.blogspot.com/2013/12/deploying-destructive-changes-using.html) for some pictures and nice cloud-like palettes.

  • Interesting. I never played with the workbench before. Thanks! Maybe I can get away without installing Eclipse :) Commented Aug 13, 2014 at 18:16
  • 1
    This is brilliant and such a huge time saver! There are so many dependencies with the Force.com IDE (Java/Network settings). I wish I knew about this before! :) Thank you! Commented Mar 8, 2016 at 13:08
  • 2
    @Robs <?xml version="1.0" encoding="utf-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <types> <members>SomeTestClass</members> <members>SomeOtherClass</members> <name>ApexClass</name> </types> <types> <members>SomeTrigger</members> <members>SomeOtherTrigger</members> <name>ApexTrigger</name> </types> <version>30.0</version> </Package>
    – sfdcfox
    Commented Jul 10, 2018 at 15:26
  • 1
    @ChristopherD.Emerson Check your Deployment Status in Setup. It will report any errors and/or what was modified.
    – sfdcfox
    Commented Jun 17, 2020 at 11:48
  • 1
    @ChristopherD.Emerson Did you get this figured out? I'm having the same issue today, and this process has always worked. I see no errors when I check Deployment Status in Setup. The deployment ran fine, all tests passed, but the class is still there afterwards. I've verified the two files are correct, class name is spelled right, etc. I did notice "Number of Components Deployed" is zero, but I think it's always shown that when deleting, but I'm not sure. It's always worked in the past so I haven't really paid attention to that. Commented Sep 9, 2020 at 22:19

Based on this post on tooling API:


I tried deleting a class from my developer account and I was able to do it using workbench by just providing the class Id and using delete( Sys admin profile)

I am not sure if this would apply for your PRD org. Would be worth giving this a try.

enter image description here

Deleting a Apex Class:

// [Status=No Content, StatusCode=204] public void deleteApexClass() { HttpRequest req = createHttpRequest(endpoint+'/ApexClass/'+oid,'DELETE'); String responseJson = getResponse(req); // Store the result to do something }

  • 1
    Nice idea, rao, but I'm pretty sure the tooling API can't do this, because it's synchronous, and the user has to run all tests in order to change a file in prod. I don't have a production I can test this on, but you're welcome to actually try and do so. I'd love to see it be that easy, because it's far less complicated than my answer.
    – sfdcfox
    Commented Aug 11, 2014 at 22:01
  • @sfdcfox I tried it in my developer account on na14 instance and the class was deleted, is there any difference between an actual PRD instance compared to a developer PRD instance?
    – Rao
    Commented Aug 11, 2014 at 22:04
  • 2
    Class access is greatly relaxed compared to prod instances. In the workbench, you can also go to "info" > "metadata types & components" > "ApexClass", open "Components", then the class, then hover over "Id" and choose "delete". Same thing as the tooling API without having to remember the URL.
    – sfdcfox
    Commented Aug 11, 2014 at 22:06
  • I do not have access to a PRD org to test this too. I was not sure if this would work in an actual PRD org so I had the disclaimer asking the OP to give it a try.
    – Rao
    Commented Aug 11, 2014 at 22:14

Here is a guide to deleting a class using the Force.com Migration Tool which uses Ant.


  • 1
    User "can't" install software, although using the migration tool isn't strictly an install (just unzipping), it's still extra software that IT might not like. Personally, that's what I'd do though. I like the migration tool.
    – sfdcfox
    Commented Aug 11, 2014 at 22:00
  • 1
    He said he can't install Eclipse, he didn't mention Ant / other command line tools. Ultimately it comes down to his companys IT policy and how literally he wants to take it. Commented Aug 11, 2014 at 22:08
  • 3
    "I dont want to use ANT or special software. SF must have a native way to achieve this." -- I think that this kind of suggests that OP can't or won't use Ant.
    – sfdcfox
    Commented Aug 11, 2014 at 22:15

You can delete classes via the Workbench but as all of you know this currently does not work in production environments as it is mandatory that you run all the tests when deleting a class (which is also why Rao's answer won't help). You can, however, do this via a SOAP call using some SOAP request builder.

You would have to send a CompileAndTestRequest and list the classes you want to delete under deleteClasses.

As far as I'm aware (but not quite sure) the Workbench also uses SOAP calls so in theory it could be changed to allow this as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .