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
Andrey VyshinskiyAndrey Vyshinskiy 

How do I remove apex trigger from my org?

I trying to remove the following Apex Trigger TasksToOpps from my org. How can I do that? Right now I have no way to remove it or deactivate it. User-added image
Best Answer chosen by Andrey Vyshinskiy
HARSHIL U PARIKHHARSHIL U PARIKH
We can not directly de-activate the triggers in prodution!

I would suggest taking following approach,
1) First, go to the sandbox where this Trigger is and DeActivate in Sandbox. Once you find the trigger in sandbox, you will see EDIT button unlike in Production.
2) Once de-activated, make a change set (Go to out-bound change set from quick find search) and then add the trigger as well we the Test classes with it. Upload it.
3) Now, withIn 10 to 20 minutes, you go to the Production => Quick FInd Search for In bound change set and there you will see a ready to deploy the change set.
4) When deploying the change set you will be asked to Run to run test class and so please select the 4th option which is Run Specific test class and then put your test class's API name there.
5) Now, go to the trigger in production and you will see Status = InActive

Hope this helps and if it solves the query then please mark it as best answered!

All Answers

HARSHIL U PARIKHHARSHIL U PARIKH
We can not directly de-activate the triggers in prodution!

I would suggest taking following approach,
1) First, go to the sandbox where this Trigger is and DeActivate in Sandbox. Once you find the trigger in sandbox, you will see EDIT button unlike in Production.
2) Once de-activated, make a change set (Go to out-bound change set from quick find search) and then add the trigger as well we the Test classes with it. Upload it.
3) Now, withIn 10 to 20 minutes, you go to the Production => Quick FInd Search for In bound change set and there you will see a ready to deploy the change set.
4) When deploying the change set you will be asked to Run to run test class and so please select the 4th option which is Run Specific test class and then put your test class's API name there.
5) Now, go to the trigger in production and you will see Status = InActive

Hope this helps and if it solves the query then please mark it as best answered!
This was selected as the best answer
NagendraNagendra (Salesforce Developers) 
Hi Andrey,


An easy way to do this is as follows:
  1. Use an IDE to create a new project and download all classes from production.
  2. In the class you want to delete, open the metadata file and change the status of the class to "deleted".
  3. Save to the server.
Observe the status of the class in the example below:
<?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>23.0</apiVersion> <status>Deleted</status> </ApexClass>
You should try this in the sandbox and become comfortable with it before attempting it in production. Double-check the class name before deleting.

For more information may I suggest you please check with below links from the stack exchange community which will help you accelerate further with the above requirement? Please let us know if you have any further queries.

Mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Thanks,
Nagendra
Raj VakatiRaj Vakati
Hi Andrey ,
Absolutely it's possible to delete the trigger from the production.

Options 1 : Force.com IDE
An easy way to do this is as follows:

Use an IDE to create a new project and download all classes from production.
In the class you want to delete, open the metadata file and change the status of the class to "deleted".
Save to the server.
Observe the status of the class in the example below:

     <?xml version="1.0" encoding="UTF-8"?>
     <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
         <apiVersion>23.0</apiVersion>
         <status>Deleted</status>
     </ApexClass>
You should try this in sandbox and become comfortable with it before attempting it in production. Double-check the class name before deleting.

Options 2: -Using ANT


Construct your destructiveChanges.xml file and Run the ANT 



 


 
Andrey VyshinskiyAndrey Vyshinskiy
Thank you, everyone, for your feedback.