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
LiorGLiorG 

Deleting a Trigger from Production

 I need to deactivate or delete a trigger from production asap. Can someone help me out?

 

I am the sys admin with the Unlimited Edition.

MattLacey.ax1065MattLacey.ax1065

Hi LiorG,

 

Essentially you just need to deploy the triggers folder in Eclipse minus the one you don't want — then you have the option to remove it. A faster solution to disable the trigger might be to just comment out it's contents if you're not comfortable with Eclipse. It boils down to putting a /* after the first brace ({) and then */ before the last one.

 

If there are comments using this syntax in the trigger you'll need further tags around them, in which case you may find it simpler to just start every line of the body with //:

 

trigger Contac_AfterInsert on Contact (after insert)

{

// comment

// out

// all

// of

// this

// stuff

}

 

Note: The first brace might be at the end of the first line of the file.

LiorGLiorG

Thanks Matt, but I can't even edit my trigger in production. Is there no other alternative to Eclipse?

MattLacey.ax1065MattLacey.ax1065

That's odd, as an admin you should be able to, it usually just runs all tests after making the change (i.e. does the same as a deployment).

 

You can move changes from a sandbox through changesets, I don't know personally if they can be used to remove code though.

Rahul SharmaRahul Sharma

For deleting or inactivating the only way i know is to update the metadata of the trigger from Sandbox through eclipse,

Then update the xml in metadata as:

<status>Active</status>

to
<status>Inactive</status> 

<status>Deleted</status>

 

Then save the trigger in sandbox and deploy it to the production.

MattLacey.ax1065MattLacey.ax1065

Didn't know you could do that — I always just deploy the trigger directory without the trigger in question — thanks for the tip!