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
Darshit Pathak 10Darshit Pathak 10 

What executes after before Insert and before After Insert?

I am creating a case through Digital site, on which Aura components are added for UI. When case is created through this portal, actual contact on case is different than expected. In debug log, at the end of Before Insert logic, contact is correct, but at the first line of after insert it has changed value. I am not able to understand where this value got changed between before and after insert?
AbhinavAbhinav (Salesforce Developers) 
Hi Darshit,

Order of execution doc
https://help.salesforce.com/articleView?id=000318237&language=en_US&mode=1&type=1
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm

Let me know if you have any issue or mark it best if it helps

Thanks!
Suraj Tripathi 47Suraj Tripathi 47
Hi Darshit,
Greetings!

There are only 7 events in salesforce trigger.
1. BEFORE INSERT
2. BEFORE UPDATE
3. BEFORE DELETE
4. AFTER INSERT
5. AFTER UPDATE
6. AFTER DELETE
7. AFTER UNDELETE

Only these events will run trigger.

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi