4

I have a managed package with a trigger on lead object. I added a trigger handler class and a trigger object. I wanted to know how does the trigger integrate with local triggers on package installation. For eg. Following classes are present in :

Managed package:

 LeadTrigger.trigger
 LeadTriggerHandler.cls

Subscriber org :

 LeadTrigger_local.trigger

How would the triggers work in conjunction with local triggers? Do I need to make modifications after the package is installed to add my trigger handler to the local trigger class (in this case - LeadTrigger_local.trigger) . I'm unsure how this works. Any help is appreciated.

2
  • 1
    If by "in conjunction with local triggers" you mean which fires first? then the answer is the order of execution is not guaranteed. so lets say you have a trigger on lead in managed package and a custom trigger on lead both on Insert. any trigger can fire first
    – d_k
    Commented Apr 17, 2017 at 7:24
  • 1
    They are independent of each other
    – Eric
    Commented Apr 17, 2017 at 7:28

1 Answer 1

1

Well, in a nutshell, as some people stated in the comments, the order of execution of the triggers is not guaranteed. Therefor, it's just as if you create two lead triggers in your org and then make a DML - Both will execute, but you will never know which first in advance.

You can find information regarding the order of execution in the docs, here.

Your best bet is to make the login within the trigger as solid as possible so that it won't break regardless of what other triggers in the org do. Take into account recursion scenarios, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .