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
kosmitevkosmitev 

Disable trigger which somes from a managed package from firing

Hi,

Is there a way I can disable/precent a trigger from firing if the trigger comes from a managed application?

 

The problem is that I have a managed package which has been released. There is a trigger which is useful to some cutomers and not useful to other and I need a way to disable it from those who do not want it.

 

Thanks,

Kos

Best Answer chosen by Admin (Salesforce Developers) 
NuDevNuDev

There are a couple of ways to do this, actually, but you would need to re-release your package. 

 

We went the route of having a custom 'Settings' object, but similar functionality can be had by using Custom Settings. Basically, we query for our custom Settings object (there's one or zero records in this object) and check a field, say 'RunThisParticularTrigger' to determine whether or not the trigger should execute.  The trigger is always going to be called, but you can avoid the body of the trigger this way.

 

All Answers

Sridhar BonagiriSridhar Bonagiri

Hi,

 

I think this is not possible to disable a trigger for some customers and enable for some others.

 

Sridhar Bonagiri

NuDevNuDev

There are a couple of ways to do this, actually, but you would need to re-release your package. 

 

We went the route of having a custom 'Settings' object, but similar functionality can be had by using Custom Settings. Basically, we query for our custom Settings object (there's one or zero records in this object) and check a field, say 'RunThisParticularTrigger' to determine whether or not the trigger should execute.  The trigger is always going to be called, but you can avoid the body of the trigger this way.

 

This was selected as the best answer
craigmhcraigmh

Makes me wish you could add custom fields to the Organization sObject.

kosmitevkosmitev

Thank you all for responding.

I marked as a solution NuDev's answer as it gives an alternative but I was more looking at a easier out of the box solution.

 

Kos