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
vinni shreevinni shree 

Triggers concept

A developer needs to update an unrelated object when a record gets saved. Which two trigger types should the developer create? (Choose two.)
A. after insert
B. before update
C. before insert
D. after update

Can someone please explain me the correct answer for this.

Thank you

Best Answer chosen by vinni shree
SubratSubrat (Salesforce Developers) 
Hello Vinni ,
The Correct answer for this is B and C .
Before Update and Before Insert.

Before triggers:  used to update or validate record values before they’re saved to the database.

We cannot use After trigger if we want to update a record because it causes read only error. This is because after inserting or updating, we cannot update a record.

Please check the below link for an understanding of Triggers ->

https://developer.salesforce.com/forums/?id=906F0000000AafFIAS (http://www.sfdc99.com/2014/01/25/use-vs-triggers/)
http://www.sfdc99.com/2014/01/25/use-vs-triggers/

Please check the Trailhead module on the trigger so that you can accelerate on trigger concepts one of the best ways to learn the Salesforce.Please check the link below.
https://trailhead.salesforce.com/modules/apex_triggers/units/apex_triggers_intro

I hope it will be helpful.

Please mark it as best answer if it resolved the issue.