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
Ankit Khiwansara 10Ankit Khiwansara 10 

Trigger.New Context

Hello Friends,
I am preparing for DEV 1 certification . While going over sample questions, came accross below question. 

In which two trigger types a developer modify new sObjct Record that are obtained by trigger.new context.
A) After Insert
B) After Update
C) Before Update
D) Before Insert

I think ans for this is Before Update and Before Insert, 
As record firre by after triggers are readonly since it has completed DB operation.

Could you please confirm whether my understanding is correct.
Deepali KulshresthaDeepali Kulshrestha
Hi Ankit,
Greetings to you!

- Yes right, 'Before Update' and 'Before Insert' is used to modify new sObject Record.
    
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.
Ajay K DubediAjay K Dubedi
Hi Ankit,
It's A and D because in the question they mention about "modify new sObjct Record", 
And in the case of the update, the record is not new and it's going to be updated, so the answer is A and D.

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

Thanks,
Ajay Dubedi