1 / 13

Become an Expert in Salesforce Apex Triggers | JanBask Training

Trigger support provided by Apex for management of records, as is there in the database system support triggers. Get Certification in Salesforce and become an expert.

Download Presentation

Become an Expert in Salesforce Apex Triggers | JanBask Training

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Essentials to Become an Expert in Salesforce Apex Triggers

  2. Introduction Triggers are scripts in Apex that get executed either before or post the happening of specific DML (data manipulation language) events.

  3. objective • Introduction • Key Points of Triggers • Trigger Syntax Code • Events in Trigger Syntax • Types of Triggers • Key Consideration • Trigger Exceptions • Bulk Triggers • Context Variables • Conclusion

  4. Key Points of Triggers • Many actions like insertions, deletions, etc. can be performed to the Salesforce records • There in the database system support triggers • Triggers are employed in performing those operations that are backed by certain conditions like for modification of some linked records or even preventing some operations from taking place. • Triggers are thus used for almost anything in Apex which also includes execution of SOQL and DML. • Triggers can also be employed for the performance of those tasks which cannot be undertaken by making use of the point-and-click tools in the Salesforce user interface.

  5. Trigger Syntax Code

  6. Events in Trigger Syntax • Before insert • Before update • Before delete • After insert • After update • After delete • After undelete

  7. Types of Triggers • After Triggers: They are used for accessing the field values which are earmarked by the system. It is also useful in affecting changes in other records. Every record which actually fires the after the trigger is a read-only record. Before Triggers: They are basically used for both the validation and update of various values before they have been saved in the database.

  8. Key Consideration • Upsert triggers are used for firing triggers both prior to the insert and even post the insert. It can also fire before or after the update triggers, whichever scenario fits better. • Mergetriggers, likewise are used for firing both before and after the delete for the records which are losing. It can also fire for both prior to and post the update triggers for the records which are winning. • It has been seen that the triggers that are executed post records are not deleted only end up working with certain particular objects. • There is no recording of the field history till the trigger ends. • The tracking of field history is subject to the permissions of the user, and if the latter does not have the suitable permissions but ends up in activating the trigger which makes some change to the object or field which has tracking enabled for history, no changes will be made in the history. • All kinds of callouts have to be made asynchronously from a trigger so as not to block the trigger process until there is no response for the external service.

  9. Trigger Exceptions • Triggers are also used for the prevention of DML operations from taking place by calling on the addError() method either on a record or a field. • New Records in both the insert and update triggers, and also on Trigger. • Old Records in delete triggers, the custom error message shows up on the interface of the application, and it is also logged.

  10. Bulk Triggers Bulk triggers are helpful in the handling of both solo record updates and other kinds of bulk operations, for instance: • Import of Data • Bulk API calls on the Lightning platform • Bulk or mass actions • Other kinds of recursive methods in Apex can call DML statements in bulk

  11. Context Variables • isExecuting • isInsert • isUpdate • isDelete / isUndelete • isBefore / isAfter • new / old • newMap / oldMap • operationType • size

  12. Conclusion • Knowledge of the basic aspects of the Apex triggers by taking some suitable training and certifications • So you are able to address the core issues in the same • JanBaskTraining has state of the art training modules which address all these core points along with many other vital aspects of Salesforce to prepare you for the future.

  13. Thank You Happy Learning

More Related