I am a bit confused lately regarding the order of execution of multiple updates:
Consider the following scenario:
- I have Three Records: A and B and C
- A fires an after update trigger that updates record B
- B has an after update trigger that updates a record c
- I update record A
Can someone please clarify the following questions for me?
- Do all the DML all occur in one synchronous transaction (i.e, one thread)
- Based on the Salesforce Order of Execution, Step 8 says: 'Execute all After Triggers'. When the After Update trigger gets to the line that says
update b;
What happens next?.. Is Step 1 executed for Record B OR is step 9-20 occur for record A and then the order of execution begins again for record b and the same behaviour for record C? - if an error occurs at record B (i.e, a validation rule). Will record A still be updated? Or will the whole operation roll back?
I have looked at other similar questions like this, but nothing I have found really answers the entirety of my question. Thank you in advance for your help clarifying!