Posts

Showing posts with the label apex trigger

What is trigger in Salesforce?

Image
Trigger Triggers are the set of actions that are called automatically once DML operation is performed on any object. A Trigger is an Apex code that executes before or after inserting or modifying a record based on the condition provided.  There are different types of triggers based on the action going to be performed. They are Before Triggers and After Triggers. Triggers allow modification of another record of the same type or different type. Before Trigger: They are fired before any DML operation on an object. They are mainly used for validating records.  After Trigger: They are fired after DML operation on any object. (or) used to access field values that are set by the system (such as a record's Id or LastModifiedDate field), and to affect changes in other records. The records that fire the after trigger are read-only. DML operation supported by apex trigger: Before Insert After Insert Before Update After U...