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 happens when trigger execution goes from After Insert to After Update and then validation is failed?

Assume A Lead record is inserted, in AfterInsert trigger code is written to populate some fields on the same lead, so update DML is performed on lead from AfterInsert trigger.
But on Update one custom validation rule is failed and error is thrown.
In such scenario the whole transaction should fail or only the Update part? 
AbhishekAbhishek (Salesforce Developers) 
https://albasfdc.com/2016/12/19/triggers-and-order-of-execution/

Try might assist your query.

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.
Ganesh RajputGanesh Rajput
If you have to write code for after insert and after update on the same object, you have to handle recursion for the trigger. 
If you implement it then you may get the reason why your validation is failed