+ Start a Discussion
ClaiborneClaiborne 

Different Functions All Firing on the Same Trigger

What if different Apex applications are using the same trigger to do different things? For instance, I "purchase" a de-duping service from company A, and then a lead qualifying service from company B, and then I have my own custom lead assignement tool. All are implemented as Apex code that triggers off the Lead.Save command before insert. I want to be sure that Deduping is done first, then qualifying, and then assignment.

How is order assigned to the different functions with the same trigger?

Is there a contention issue?

mtbclimbermtbclimber
Great question.

Ordering is neither guaranteed nor can it be specified today. If you control both triggers you should put the logic into the same trigger so that you can order accordingly.

As for contention, (especially in the case of triggers from different parties) yes this is certainly a possibility which we will lean on developers' tests to mitigate as much as possible.