You need to sign in to do that
Don't have an account?

How do I delete triggers from salesforce
Hi,
I had EmployeeBefore and EmployeeAfter triggers. I deleted them from Eclipse but how do I get rid of it in SF. I created a new trigger called EmployeeTrigger. When I run tests it is still executing those two deleted triggers along with Employee Trigger. So for some reason I need to delete it from Salesforce. Under src, I right clicked on Triggers and said save to server but it is still executing both before and after triggers.
Quick help would be appreciated.
thanks in advance,
kathyani
I had EmployeeBefore and EmployeeAfter triggers. I deleted them from Eclipse but how do I get rid of it in SF. I created a new trigger called EmployeeTrigger. When I run tests it is still executing those two deleted triggers along with Employee Trigger. So for some reason I need to delete it from Salesforce. Under src, I right clicked on Triggers and said save to server but it is still executing both before and after triggers.
Quick help would be appreciated.
thanks in advance,
kathyani
Using the IDE:
1) Assuming you have a sandbox environment synchronized with your Prod org, you will first want to inactivate the trigger in sandbox. You can refresh your IDE project to consume these changes
2) In the Sandbox org, you will then want to run all tests: Navigate to Setup->Develop->Apex Classes and click "Run All Tests". This will run all of the tests in the sandbox org. This is an important step to validate whether or not the inactive trigger has impacted any asserts within your test methods. Assuming this behavioral change has impacted your tests, you will need to update your asserts to reflect this.
3) Once all tests are passing, you can now deploy these changes to your production environment. You can use the Deploy to Server wizard in the IDE. Simply select the tests that you have modified, as well as the inactive trigger, and deploy these changes to your production environment.
4) Validate the trigger is now inactive in your production environment.
Deleting the trigger (if necessary - an inactive trigger will not fire and therefore can be considered as "soft deleted")
5) Create a new IDE project against your Active production org.
6) Right click on the specified trigger and select delete. Accept the option to delete from server. Since the trigger is inactive - it can now be deleted from the production environment.
You can use a similar approach with the Ant Migration toolkit. Simply update the test classes and trigger, as detailed above, and deploy. You can then use the destructivechanges.xml to remove the trigger.
All Answers
Hi,,
Can u explain how to delete trigger from sf Production org. In my production my trigger in inactive stage. eventhough i couldnt find delete button in my production org.. how is it possible....
I have developers edition. So went to Sales force web UI. Logged in. Then clicked on setup on top of the page. Then clicked on create which is displayed on the left column of the page. Clicked on objects under create. You will see a list of sobjects that you had created for your application. Click on an object for example Employee object. Then scroll down and you will see a section triggers where you will find list of triggers created for that object. Select the trigger which you do not need and delete.
Let me know if this worked.
Using the IDE:
1) Assuming you have a sandbox environment synchronized with your Prod org, you will first want to inactivate the trigger in sandbox. You can refresh your IDE project to consume these changes
2) In the Sandbox org, you will then want to run all tests: Navigate to Setup->Develop->Apex Classes and click "Run All Tests". This will run all of the tests in the sandbox org. This is an important step to validate whether or not the inactive trigger has impacted any asserts within your test methods. Assuming this behavioral change has impacted your tests, you will need to update your asserts to reflect this.
3) Once all tests are passing, you can now deploy these changes to your production environment. You can use the Deploy to Server wizard in the IDE. Simply select the tests that you have modified, as well as the inactive trigger, and deploy these changes to your production environment.
4) Validate the trigger is now inactive in your production environment.
Deleting the trigger (if necessary - an inactive trigger will not fire and therefore can be considered as "soft deleted")
5) Create a new IDE project against your Active production org.
6) Right click on the specified trigger and select delete. Accept the option to delete from server. Since the trigger is inactive - it can now be deleted from the production environment.
You can use a similar approach with the Ant Migration toolkit. Simply update the test classes and trigger, as detailed above, and deploy. You can then use the destructivechanges.xml to remove the trigger.
Step 5 and 6 fails - when I delete the trigger in Eclipse, it is not deleted from the server. Interestingly, a window pops up momentarily which seems to want to give me the option to delete it from server, but the window vanishes before I can click on it.I am using Eclipse 3.3.1.1 and IDE 19 or 20.
I had to resort to following steps I found on another thread.
Actually, what you just suggested used to work fine for me, but not a while ago I could no longer see any 'delete' rows on step 3 of the deployment, even after the triggers were inactivated and deleted from my sandbox.
This is when I've tried 5 and 6 (deleting the trigger directly from the production (on Eclipse) after they have been inactivated and deployed) and it worked!
Hello,
I try to delete a trigger and its test class from production.
I follow your process but I can't deploy an inactive trigger, I have an error.
Can you explain me how I can do this deletion ?
Thank you.
Anyone have a reason why this would not be sufficient and a "safe" practice?