+ Start a Discussion
Apex EstrategiaApex Estrategia 

How I delete trigger or class?

Hi there,

 

I'm brand new in Apex and I never used any program to create triggers or class like Eclipse or others.

What I did it’s just create the trigger or class in my Sandbox using developer console and send to my production.

 

Doing this I never learned how to delete an trigger or class in my production and this is becoming too appears some problems to me.

 

Is there an easy way to delete triggers or class from my production that are messing me up?

 

Thanks !

ForceLoverForceLover
Hi,

Please follow these steps in Eclipse to remove an unwanted trigger from production:

On Sandbox, inactivate the trigger.
Deploy the inactive trigger to production (if the code coverage is good then you should be OK to deploy).
At this point the trigger is not working in production. You do not need to delete it if you plan to activate it later and you are done. If you want to delete it, then keep going.
Remove the inactive trigger from sandbox.
On Sandbox, right click the Triggers folder and select Force.com > Deploy.
On the list of elements to deploy, make sure the checkbox for deleting the trigger is checked.
Deploy to production.
EvertonSzekeresEvertonSzekeres

Can I do this not using Eclipse? 

Bhawani SharmaBhawani Sharma
I that case you will have to go with the ant migration tool. You will have to prepare destructive changes.xml. This is lengthy.

Shortest solution is:
Create a production package in eclipse.
Open your trigger.
Mark it InActive in metadada file and save it.