What are the different types of trigger and context variables we have in Salesforce?
TechnicalSenior Salesforce DeveloperSalesforce DeveloperIn Salesforce, we have three main types of triggers: before triggers, after triggers, and instead-of triggers. Before triggers are used for validation or modifications before the record is saved. After triggers are useful for actions that require the record to be committed, like sending notifications. Instead-of triggers allow us to override standard operations, such as preventing a record from being deleted.
As for context variables, we primarily use Trigger.new, Trigger.old, Trigger.newMap, and Trigger.oldMap. These variables help us access the records before and after changes, enabling us to implement complex logic based on the state of the records.