You need to sign in to do that
Don't have an account?
Jothi Eswaran
One Trigger(T1) updates a field. This field update induces another Trigger (T2). Now both Trigger events will come under same transaction or different transaction ?
One Trigger(T1) updates a field. This field update induces another Trigger (T2). Now both Trigger events will come under same transaction or a different transaction ?
Both will come in same transaction.
Actually trigger will excecute in synchronous way.
Plz check with Execution order of Trigger in below link and specialy check with the point.no:12 in this link.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm
Ex: Supose you are having trigger on Account and Opportunity object. And you will be having functionality in Oppty trigger to update a field (Total Opportunities Amount) on Account record (Parent of oppotunity). While updating Account record from Opportunity trigger, Account trigger get fired.
These all will get in single transaction only.
Flow:
Step 1: Oppty Trigger
1. While Update Amount of Oppty
2. Oppty trigger will execute
3. Calculate all related Oppty amounts of Account
4. Update Account records with sum amounts
Step 2: Then Account Trigger will get execute
5. Account trigger excecute and do the operation mentioned there.
6. Update the account with Sum amount
Step 3: Commit All transaction.
Hope it will clear your doubt. ANd let me know if still having doubt.
Thanks
Niraj