What is the difference between Trigger.New and Trigger.Old?
TechnicalSenior Salesforce DeveloperSalesforce DeveloperSalesforce EngineerTrigger.New contains the new versions of the records being processed, while Trigger.Old holds the previous versions. This distinction is crucial during insert and update operations, as it allows me to compare changes and implement business logic accordingly.
For example, in an update trigger, I can check if a field value has changed by comparing Trigger.New to Trigger.Old. This helps in enforcing validation rules or maintaining data integrity.