When to use triggers in Salesforce
Triggers are used to perform immediate actions based on previous action.
Example: field update

A trigger is Apex code that executes before or after specific Data Manipulation Language (DML) events occur, such as before object records are inserted into the database, or after records have been deleted.

trigger triggerName on ObjectName (trigger_events)

where trigger_events can be a comma-separated list of one or more of the following events:

before insert
before update
before delete
after insert
after update
after delete
after undelete

Written by 

2x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *