+ Start a Discussion
Deepak PansariDeepak Pansari 

Preventing trigger execution?

Hi All,

 

I have 2 trigger ( before update) in Lead object , Trigger1 and Triiger2.

 

Is there any way , where i system will fire only one trigger.

 

I mean to say , if any one of trigger is executed then second one will not executed , order does not matter.

 

Any idea , apart from setting a flag in lead object.

 

Thanks,

Deepak 

 

 

Navatar_DbSupNavatar_DbSup

Hi,

 

There is no way to stop the execution of a trigger. You can create a custom flag field in the lead object and check the flag in the trigger for avoiding the execution of the functionality of another trigger.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Chamil MadusankaChamil Madusanka

Don't use multiple triggers on same object. That will catch apex code scanner.  Use one trigger for one object and try to avoid unnecessary code blocks through your logic. That's a best practice of writing triggers.

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

Imran MohammedImran Mohammed

The best thing will be to move the code into a single trigger as both are on before update.

Is there any specific reason why you have two triggers for the same event on Lead object.