2. Go to the developer workbench: https://workbench.developerforce.com/
3. Click on the "Retrieve" section on the top, choose your package XML file created and then submit.
4. In your downloaded package.xml file, click on the XML data file and change the status from "Active" to "Deleted."
For more information on package.xml files: https://www.salesforce.com/us/developer/docs/api_meta/Content/manifest_samples.htm
For metadata types useable with this download format: https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_types_list.htm
For trigger metadata attributes: https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_triggers.htm
It goes without saying, please be very careful when doing this process and always make sure that you are in the appropriate org in workbench before doing these types of updates. You can see where you are at by hovering over the company name in the upper right-hand corner.
If this answer is helpful to you, please mark as the best answer to assist others that may have this issue.
How to Disable or Delete an Apex Class or Trigger from a Production Org Knowledge Article Number: 000006188
Description- An Apex class or trigger must be removed from a production instance if it is blocking a deployment or is no longer needed. - Apex code may not be modified directly within a Production org, so it requires a couple of steps using Developer tools. - This article gives instructions using the Force.com IDE - This is the only way an Administrator or Developer can disable or remove Apex in a Production org.
Resolution- Force.com IDE should be installed and working. - Connect to the Sandbox Instance using the IDE and find the class or trigger that you want to delete. - Open the matching .xml file change the Status XML tag from "Active" to "Deleted" if you want to remove the trigger or class, or to "Inactive" if you want to disable the trigger. - Apex class Status can only be changed to "Active" or "Deleted", not "Inactive". - Save the file. - Select the two files (Code and XML) using Ctrl-click, then right click on one of them. Select Force.com > Deploy to server. - Provide your credentials for the production org and follow the steps.
2. Go to the developer workbench: https://workbench.developerforce.com/
3. Click on the "Retrieve" section on the top, choose your package XML file created and then submit.
4. In your downloaded package.xml file, click on the XML data file and change the status from "Active" to "Deleted."
For more information on package.xml files: https://www.salesforce.com/us/developer/docs/api_meta/Content/manifest_samples.htm
For metadata types useable with this download format: https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_types_list.htm
For trigger metadata attributes: https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_triggers.htm
It goes without saying, please be very careful when doing this process and always make sure that you are in the appropriate org in workbench before doing these types of updates. You can see where you are at by hovering over the company name in the upper right-hand corner.
If this answer is helpful to you, please mark as the best answer to assist others that may have this issue.
I am following you since 2015 January I got lots help form your website actually I am providing Help With Dissertation Writing (http://www.Dissertationhouse.co.uk/) I always prefer your site to students and just want to say two words for you “Thank You”.
That means that you're missing the version element in the package.xml file. Please see the above properly formatted package.xml file. The current API version is 38 if you're on Winter '17 or 39 if you're on Spring '17 (I'd go with v38 to be safe).
Are you zipping the file for your retrieve via workbench or are you retriving via ant? The actual formatting of your file appears to be correct. You may need to change it to version 37.0 for your retrieve if you are using workbench since they do not have v38 available there yet.
There are a number of ways to stop a trigger to run. I've consolidated the list. Read here https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/
Jeremiah: In Step 1 above where you say "Create a package XML file." What is that and how exactly do I do that? I'm an admin with no developer experience, and I didn't quite understand the information in the link you shared for more information on package XML files. Thanks for any direction you can give me!
Interesting post i have been wondering about this issue, so thanks for posting. Pretty cool post. It’s really very nice and Useful post. Thanks. http://www.axivasichem.com/
... it won't delete!: I had a visualforce page, apex class and apex test class to delete. I attempted to delete them in three stages:
I created the package file with just the test class. I retrieved the package and then edited the class meta data files to change Active to Deleted. I then zipped it back (called it repackaged.zip) and deployed it using "Rollback On Error", "Single Package" and "Run local tests". This deleted the test class.
I then went to setup in salesforce, found the Visualforce page and deleted it. (otherwise, class is dependent and can't be removed). OK.
I changed the package file to list the active class, retrieved it and changed the meta data to 'Deleted'. Zipped and deployed as above but it won't delete. It doesn't say why. Frustrating...
I took a deep breath then went back to basics: I used the "destructiveChanges.xml" method. See http://www.salesforceben.com/way-to-delete-apex-classes-from-production/ https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/daas_destructive_changes.htm
First made sure I'd deleted the visualforce page that called the controller.
When I deployed my changes, I got an error saying my class had been used in a lightning bundle. How do I put a lightning bundle into the destructiveChanges xml? Turns out, there's no need. I ran the Dev Console from production, opened the offending bundle and was able to delete it via the file menu. I checked and, yes, it had gone.
I then deployed my package again and succesfully removed my class and test class. Happy again! :)
The good news is lot about work that ought to be done to ensure if you have a building is normally fit just for tenancy. The governing of Dubai could be very particular in the case of quality for the indoor environment from the building. For that matter, the governing has a requirements specifically fond of the repairs and maintenance of work sites as soon as completion from the project. cleaning services in dubai (https://www.springcleaning.ae/)
Steps:
1. Create a package XML file (replace your trigger name below):
2. Go to the developer workbench:
https://workbench.developerforce.com/
3. Click on the "Retrieve" section on the top, choose your package XML file created and then submit.
4. In your downloaded package.xml file, click on the XML data file and change the status from "Active" to "Deleted."
For more information on package.xml files:
https://www.salesforce.com/us/developer/docs/api_meta/Content/manifest_samples.htm
For metadata types useable with this download format:
https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_types_list.htm
For trigger metadata attributes:
https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_triggers.htm
It goes without saying, please be very careful when doing this process and always make sure that you are in the appropriate org in workbench before doing these types of updates. You can see where you are at by hovering over the company name in the upper right-hand corner.
If this answer is helpful to you, please mark as the best answer to assist others that may have this issue.
All Answers
https://help.salesforce.com/HTViewSolution?id=000006188&language=en_US
How to Disable or Delete an Apex Class or Trigger from a Production Org
Knowledge Article Number: 000006188
Description- An Apex class or trigger must be removed from a production instance if it is blocking a deployment or is no longer needed.
- Apex code may not be modified directly within a Production org, so it requires a couple of steps using Developer tools.
- This article gives instructions using the Force.com IDE
- This is the only way an Administrator or Developer can disable or remove Apex in a Production org.
Resolution- Force.com IDE should be installed and working.
- Connect to the Sandbox Instance using the IDE and find the class or trigger that you want to delete.
- Open the matching .xml file change the Status XML tag from "Active" to "Deleted" if you want to remove the trigger or class, or to "Inactive" if you want to disable the trigger.
- Apex class Status can only be changed to "Active" or "Deleted", not "Inactive".
- Save the file.
- Select the two files (Code and XML) using Ctrl-click, then right click on one of them. Select Force.com > Deploy to server.
- Provide your credentials for the production org and follow the steps.
Steps:
1. Create a package XML file (replace your trigger name below):
2. Go to the developer workbench:
https://workbench.developerforce.com/
3. Click on the "Retrieve" section on the top, choose your package XML file created and then submit.
4. In your downloaded package.xml file, click on the XML data file and change the status from "Active" to "Deleted."
For more information on package.xml files:
https://www.salesforce.com/us/developer/docs/api_meta/Content/manifest_samples.htm
For metadata types useable with this download format:
https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_types_list.htm
For trigger metadata attributes:
https://www.salesforce.com/us/developer/docs/api_meta/Content/meta_triggers.htm
It goes without saying, please be very careful when doing this process and always make sure that you are in the appropriate org in workbench before doing these types of updates. You can see where you are at by hovering over the company name in the upper right-hand corner.
If this answer is helpful to you, please mark as the best answer to assist others that may have this issue.
But not sure about the next step. Do I use the Workbench > Migration > Deploy?
When I try to retrieve the XML document, I get this error:
'version' element is required
Is there something that I'm missing here?
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>NumberContacts</members>
<name>ApexTrigger</name>
</types>
<version>38.0</version>
</Package>
Thanks!
https://sfdcfanboy.com/2017/11/23/a-tip-a-day-23-5-ways-to-stop-trigger-in-production/
I had a visualforce page, apex class and apex test class to delete.
I attempted to delete them in three stages:
I created the package file with just the test class.
I retrieved the package and then edited the class meta data files to change Active to Deleted.
I then zipped it back (called it repackaged.zip) and deployed it using "Rollback On Error", "Single Package" and "Run local tests".
This deleted the test class.
I then went to setup in salesforce, found the Visualforce page and deleted it. (otherwise, class is dependent and can't be removed). OK.
I changed the package file to list the active class, retrieved it and changed the meta data to 'Deleted'. Zipped and deployed as above but it won't delete. It doesn't say why.
Frustrating...
I used the "destructiveChanges.xml" method.
See
http://www.salesforceben.com/way-to-delete-apex-classes-from-production/
https://developer.salesforce.com/docs/atlas.en-us.daas.meta/daas/daas_destructive_changes.htm
First made sure I'd deleted the visualforce page that called the controller.
When I deployed my changes, I got an error saying my class had been used in a lightning bundle.
How do I put a lightning bundle into the destructiveChanges xml?
Turns out, there's no need.
I ran the Dev Console from production, opened the offending bundle and was able to delete it via the file menu.
I checked and, yes, it had gone.
I then deployed my package again and succesfully removed my class and test class.
Happy again! :)
https://app.clickdeploy.io/
Create a deployment package and go to the Deploy Options tab, Change button, Deploy Type: Destructive, and Save.
Then add the items you want to delete to to the deployment package and click Deploy.
Blog article explaining this method:
https://medium.com/@clickdeploy_team/delete-apex-classes-from-production-3c66306f1a0e