Welcome to my blog

I have been working with Salesforce for quite a while, so don’t hesitate to contact me if you have any questions or want some advice.

s f

Follow Us




What is Apex Trigger? Learn Types of Triggers in Apex Salesforce


Trigger is an apex script that executes before or after specific Data Manipulation Language(DML) event occur, such as before object records are inserted into the database or after records have been deleted. It enables us to perform custom actions before or after events to record in salesforce, such as insertions, updates, or deletions.

Syntax for Triggers:

 trigger Trigger Name on Object Name (trigger_events)                                                 




To execute a trigger before or after insert, update, delete, and undelete operations, specify multiple trigger events in a comma-separated list. The events we can specify are:

  • before insert
  • before update
  • before delete
  • after insert
  • after update
  • after delete
  • after undelete

Types of Triggers:                                                                                                                                         

  1.Before Trigger 

   2.After Trigger      

1.Before Trigger                                                                                                                            It is used to update or validate the record values before they saved to database.

2.After Trigger                                                                                                                                                     It can be used to access the field values that are set by the system and to affect changes in other records.                                                                                                                                    The records that fire the after trigger are read-only.



Post a Comment