Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Episode 12 - Basics of Trigger

646 views

Published on

How to write triggers in Salesforce and various events supported by Trigger

Published in: Education
  • Be the first to comment

  • Be the first to like this

Episode 12 - Basics of Trigger

  1. 1. Path to Code Begin Your Salesforce Coding Adventure
  2. 2. Episode 12 Basics of Trigger
  3. 3. Salesforce MVP, Founder of ApexHours Follow me at @Amit_SFDC @ApexHours Amit Chaudhary
  4. 4. Agenda • What is Trigger • Context Variable • Before Vs After • Demo • Bulkify Trigger and Trigger Best Practice • Why Framework ?
  5. 5. Some House Rules • Mute your mic • Keep adding questions in Zoom Q&A Window • No question is too small • Questions will be answered in last 15 mins
  6. 6. What is Trigger Apex triggers enable you to perform custom actions before or after changes to Salesforce records, such as insertions, updates, or deletions. A trigger is Apex code that executes before or after the following types of operations: ● insert ● update ● delete ● merge ● upsert ● undelete
  7. 7. Context Variable ● isExecuting ● isInsert ● isUpdate ● isDelete ● isBefore ● isAfter ● isUndelete ● new ● newMap ● old ● oldMap ● size
  8. 8. Before Vs After Trigger ? Before used to update or validate record values before they are saved to database. After to access field values that are set by the system (such as a record's Id or LastModifiedDate field) to affect changes in other records, such as logging into an audit table or firing asynchronous events with a queue. The records that fire the after trigger are read-only
  9. 9. Let’s Create One Trigger
  10. 10. Trailhead Modules Apex Triggers
  11. 11. Thank You
  12. 12. Subscribe

×