function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rakshith RamachandraRakshith Ramachandra 

Deleting classes/triggers from Production

I'm trying to delete few classes from Production environment. 
At first I tried to delete these without the help of Eclipse Force.com IDE and deleted those classes directly from sandbox env.

However, I still see those classes in Production. So I installed Eclipse and Force.com IDE and trying to mark the class "Deleted" in xml and deploy them. The problem is I can't find these classes in Sandbox at all as I deleted from website directly.

Any idea how to deal with this situation?
Best Answer chosen by Rakshith Ramachandra
Adrian  GawryszewskiAdrian Gawryszewski
Hi Rakshith

I'm not working with Force.com IDE myself and don't know how to tackle it this way, but....

You could always use Migration Tool and destructive change provided to remove those class/trigger quite easly. 

https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool.htm

I personally think it is very easy to config and use and could sort out your problem.

All Answers

Rakshith RamachandraRakshith Ramachandra
This is the production env
The above SS is the production env.

Sandbox Env
The above SS is the sandbox env.

You can see the class "ChatterAnswersEscalationTriggerTest" is not present in Sandbox. How do I delete that class from Prod?

Thanks,
Rakshith
Adrian  GawryszewskiAdrian Gawryszewski
Hi Rakshith

I'm not working with Force.com IDE myself and don't know how to tackle it this way, but....

You could always use Migration Tool and destructive change provided to remove those class/trigger quite easly. 

https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/forcemigrationtool.htm

I personally think it is very easy to config and use and could sort out your problem.
This was selected as the best answer
Adrian  GawryszewskiAdrian Gawryszewski
It took me 20-30 minutes to download and install and sort it out, but I'm quite an experienced developer. Assuming you need to read the instruction first it may take you 2-3 hours max. The process is quite straighforward and well documented.

URL: https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/meta_development.htm

 
Rakshith RamachandraRakshith Ramachandra
I appreciate your quick reply. Setting up Eclipse Force.com IDE almost took a day. How complicated is it to set up ANT and migration tool?
Rakshith RamachandraRakshith Ramachandra
I just wish if there was a quick way of doing it from Eclipse Force.com IDE. However, Thank you for all the help! 
Rakshith RamachandraRakshith Ramachandra
Hey Adrian, I'm trying set up Migration tool. I have a silly doubt. Where is the file "package.xml" located? Do I create one on my own? If yes, where should I save it (the folder structure)?

Thanks in advance
Adrian  GawryszewskiAdrian Gawryszewski
Ok so  if you unzipped it you will have the following folders:

{main_folder}/sample/codepkg
{main_folder}/sample/mypkg - 
{main_folder}/sample/removecodepkg
{main_folder}/sample/unpackaged

First two by default are used to upload code/object/other meta. So f.e. if you want to upload  sampleClass and sampleClassTest you put files in one of them together with correct package.xml (it's just FYI).

A folder that you should pay more attention to is the removecodepkg. Inside you have a xml file called destructiveChanges.xml. It looks the same as a regular package.xml except it contains metadata of stuff you want to get rid of. 

For your own safety test it on the sandbox first so you get a feel for it.



 
Rakshith RamachandraRakshith Ramachandra
Thanks a lot man. It was a great help. This tool does have some advantages. I saw some tutorials and was able to figure how stuff works. Atleast the basics. 

Cheers
Rakshith