Performing tailored database actions is one of the main features of Salesforce Apex and this is done through triggers. The module is divided into two units which should take 30 minutes each to complete.
Unit 1: Get Started with Apex Triggers (Duration – 30 minutes)
You’ll learn how to write triggers for Salesforce objects. Apex triggers give you the ability to perform specific tasks before or after an event to Salesforce records like deletions, updates, and insertions.
There are various context variables that you can use in an Apex trigger and you’ll learn them in this unit. Learning each one will help you code faster and more efficiently. Context variables are used when you need to access records that have set off the trigger.
Code reuse simplifies the development process which also reduces trigger size and simplifies Apex code maintenance. It is essential to object-oriented programming.
Triggers are usually used to manage and access records. It’s also important to know which records fired the trigger. Triggers also add related opportunities for new or updated accounts that are associated with existing accounts.
Units 2: Bulk Apex Triggers (Duration – 30 minutes)
Apex triggers are designed to work optimally in bulk. Bulk design patterns are actually recommended when processing records via triggers. Through bulk design patterns, triggers perform better, exceed limitations set by the platform, and consume minimal server resources.
The basic concept in bulk design is by operating on multiple sObjects within the context of the trigger. When the action’s origin was the API or bulk DML, the trigger works on the record set instead of a single record. You’ll learn about this approach in this unit.
You’ll also learn about the features of SQQL and how you can use them to simplify your code and make fewer database queries, therefore, reducing the need for machine resources when running Salesforce.