Basics of Triggers
Chapter Topics
- Basics of Triggers
- When to use triggers
- Types of Apex Triggers in Salesforce
- Trigger Order of Execution
- Trigger Context Variables in Salesforce
- Trigger.new in Salesforce| Context Variables in Apex Triggers
- Trigger.old in Salesforce | Context Variables in Apex Triggers
- Trigger.newMap in Salesforce| Context Variables in Apex Triggers
- Trigger.oldMap in Salesforce| Context Variables in Apex Triggers
- Trigger Exceptions
- Best Practice in Triggers
- Trigger Helper Class Pattern
There are many actions that take place in Salesforce. To make these tasks easier, the trigger function was specifically designed to trigger action once a new record is created and old records are deleted or updated. In this chapter, we will learn about the basics of Apex Trigger And how you can create one.
What is the Salesforce Apex Trigger?
Salesforce Apex Trigger is an Apex code that executes before or after changes occur to Salesforce records. It is one of the most important functions and topics in the Apex Program.
For example, you can have a trigger run before an object’s records are inserted into the database, after records have been deleted, or even after a record is restored from the Recycle Bin.

Join our newsletter: Get daily update on Salesforce career insights & news!
Join Now!
Need more support?
Get a head start with our FREE study notes!
Learn more and get all the answers you need at zero cost. Improve your skills using our detailed notes prepared by industry experts to help you excel.