How to remove Apex class in Salesforce Enterprise Edition using Eclipse?

How to remove Apex class and run it in Salesforce Enterprise Edition using Eclipse?

+4
source share
5 answers

To remove a trigger from a production organization using eclipse, you will need to use the following steps (assuming you have an org sandbox):

  • Via the web interface in your org sandbox, inactivate the trigger
  • Update your sandbox project in eclipse and deploy an inactive trigger for production
  • Update your production project in eclipse, right click on the trigger and select delete
  • Accept the uninstall option from the server

I believe that the above steps will work, however I only removed components from the manufacturing organization using destructive changes and the Ant Migration Toolkit.

To use the Ant Migration Toolkit for a destructive change, you need to configure the destructivechange.xml file to look something like this:

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

There are complete instructions on how to thwart destructive changes at the developer level.

+3
source

I had an almost duplicated question and landed here. I want to remove a class using only Force.com IDE (Eclipse) from my org organization . Inediger described how to deploy a set of destructive changes using the Ant Migration Toolkit and figured out how to do it in the Force.com IDE. In my attempts with Force.com IDE version 20.0, steps 3 and 4 of Inediger will not let you remove the class / trigger in your org organization.

Here's a natural attempt to remove a class in the Force.com IDE:

  • Select a class. Click delete.
  • "Do you really want to delete the file 'myClass.cls'?" ... OK
  • "The requested operation will be deleted locally only locally. Would also like the resource to be deleted from the server?" ... Yes

At this point, the file is deleted from your project and your org organization, but it remains in your org organization (and the admin web interface will not allow you to delete it there) to continue:

  • Deploy the server.
  • Enter your business organization credentials.
  • Further. Further.
  • Look for your class in the list of deployment candidates, but it does not exist!

Unfortunately, your class will not be listed in the deployment candidate list because Force.com IDE has already lost this file (because you deleted it - if you recreate the class in your boat in your dev org and follow my instructions below).

We need to delete it during the production process before deleting the file locally (I think we go through the Force.com IDE, creating one of these destructive change sets and deploying it for us):

  • Edit the appropriate class of the * -meta.xml file (from the Force.com IDE).
  • Set the status to "Deleted": <status> Deleted </status>. Save.
  • Right-click your class, Force.com | Deploy the server.
  • Enter your business account credentials.
  • You should see that your class is the only candidate for deployment!
  • Check the box next to "Apply action"? Overwrite your class.
  • Follow the path through the rest of the masters.

If you follow the Salesforce admin web pages, you will notice that the class disappears from your dev org after saving in step 2. It disappears from your org org when you get a green checkmark after step 7.

Finally, I remove the class from the Force.com IDE, as usual. When he asks me if I want to delete the file from the server, I say no, because we already took care of that. I also add / remove metadata components and remove its name to get rid of the warning message.

+3
source

The easiest way to do this is to delete the file from your project in Eclipse (without deleting it from the server, because it does not work), and then you right-click on FOLDER (i.e. triggers / classes) and select "Deploy to" Server.

When a dialog box appears that shows what you want to expand, the class / trigger in question will be highlighted as a red line, which means that you can check it for removal from the manufacturing organization.

+3
source

The easiest way to do this from Eclipse is to edit the -meta.xml file for the class you want to delete. All you have to do is change the Status field from Active to Deleted.

When you save the -meta.xml file, the corresponding class will be immediately removed from your org organization. Class files and .xml will still be located in your local Eclipse folder, but you can simply delete them locally.

+2
source

One of the ways I tried:

1) Go to the XML metafile for the trigger [in the Force.com IDE] and set the status value to Delete.

2) Then, after saving this .xml file, I deploy the trigger for production.

I am sure I have to delete the file. I also did this with the class file, but unfortunately it was a test class file, and I forgot to delete other related files for which the test file provided test coverage, and therefore I lost a significant aggregate set of tests due to this error. Fortunately, I saved the file before I deleted it, and was able to redeploy the modified test class before production, and everything was fine again.

0
source

Source: https://habr.com/ru/post/1339133/


All Articles