Become an Expert in Salesforce Apex Triggers | JanBask Training - PowerPoint PPT Presentation

About This Presentation
Title:

Become an Expert in Salesforce Apex Triggers | JanBask Training

Description:

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. – PowerPoint PPT presentation

Number of Views:715

less

Transcript and Presenter's Notes

Title: Become an Expert in Salesforce Apex Triggers | JanBask Training


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
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.
  • Merge triggers, 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
  • JanBask Training 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
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com