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
JayyyJayyy 

Apex Triggers : If an object has multiple (assume two) before triggers and if first picked trigger inserts a record, does second trigger executes twice?

Apex Triggers : If an object has multiple (assume two) before triggers and if first picked trigger inserts a record, is second trigger invoked twice? First time from the initial insert and second time due to an insert operation from first trigger. (I understand order is not guaranteed. but, jsut thinking what would happen if it is picked this way)
Abhilash Mishra 13Abhilash Mishra 13
Nope, First of all no DML Operation are performed in before trigger , which means no commit to DB. 
Depending upon the order , you might find disparency in the values updated, but trigger will not fire twice.



 
JayyyJayyy
Thanks Abhishek for the response. But, how is this restricted? Assume I have class written which is triggered on a trigger event. If I do  DML operation in this class/method, does before trigger gets to  know about it and throws an error even if it is not causing any other problem?