+ Start a Discussion
sreedharp286sreedharp286 

order of multiple triggers one by one on one object in salesforce

Con anyone help me

souvik9086souvik9086

Here you will get the complete story 

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_triggers_order_of_execution.htm

 

#Note: Although it is not advisable to use multiple triggers on the same object, but sometimes situation comes to create it.

Before Triggers

After Triggers

 

If you have two before/after triggers for the same object then that sequence is random. Anyone can be called first.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

sreedharp286sreedharp286

 What you heve suggested that is order of execution in salesforce but what i am asking is 

 

i have 4 triggers on case object , how to sequencial execute 4 triggers one by one whichever i specify 

this is my issue 

souvik9086souvik9086

If you can check the post again you will found that r before triggers will execute first then the after triggers.

 

But if you have two before triggers or two after triggers for the same object then those trigger execution is random. You cannot say which before trigger will call first.

crop1645crop1645

Souvik is correct -- you can't rely on order of execution of >1 trigger of the same type; A good solution if you have complete control over your triggers is to implement this pattern: http://developer.force.com/cookbook/recipe/trigger-pattern-for-tidy-streamlined-bulkified-triggers 

 

I use this pattern in all my projects as it allows me control over execution order as there is only a single Trigger per SObject. Very clean, very nice