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
travis.truetttravis.truett 

Disable Apex Trigger?

I deployed a trigger today, and it's running smoothly, but I forgot about a change I wanted to make to it in order to make it run more smoothly/avoid bugs. How do I actually remove an apex trigger from salesforce? Thanks
Himanshu ParasharHimanshu Parashar
Hi Travis,

You can remove any metadata component using Force.com Ant Migration Tool or Eclipse IDE. It may be sound bit technical so you can simply deploy your trigger as inactive using changeset.

Thanks,
Himanshu
Vivek DeshmaneVivek Deshmane
Hi Travis,

If your using change set to deploy then Inactive trigger in sandbox and deploy it  to prodution.
if your using Eclipse thne checkout trigger in eclipse make inactive from Trigger Metada xml and save the changes.
If your using ant migration then add trigger entry in distructive .xml deploy to production
Please let me know if it helps you.
Regards,
-Vivek
Himanshu ParasharHimanshu Parashar
Here is the details procedure to do that.

https://help.salesforce.com/apex/HTViewSolution?id=000003942&language=en_US

Thanks,
Himanshu
Salesforce Certified Developer, Administrator, Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Azhar Aziz GAzhar Aziz G
Hey Travis - There are two options.
  1. You should need to create new sandbox for the production envirement and then move apex trigger to sandbox. update this trigger in sandbox and then deploy changes to production.
  2. Create project in eclips ( Force.com IDE ). and then you can delete or update trigger from the eclipse.
Thanks,
ManojjenaManojjena
Hi travis.truett,
If you want to delete the trigger from Production ,then eaisly you can delete through Eclipse .Create a project from your production in eclipse .Pull the trigger into your project .Click on the xml file related to your trigger .
you will find the xml file like below .
 
<?xml version="1.0" encoding="UTF-8"?>
<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>27.0</apiVersion>
    <status>Deleted</status>
</ApexTrigger>
In the above code I have chaged teh status to deleted ,you will find as Active ,if you want to delete you need to add as above Deleted else if you want to you need to change to Inactive and deploy to server .Automatically your trigger will cahnge your status .if you va addded to deleted it will delete from production .

Let me know if it helps .

Thanks
Manoj