- Returns a list of the new versions of the sObject records.
- Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.
Trigger.old stores the old values of a record. This basically means that when you edit a record and save it, your trigger would be called and the values that were available before you edited the record would be stored in Trigger.old.
- Returns a list of the old versions of the sObject records.
- Note that this sObject list is only available in update and delete triggers.
Context Variable Considerations
- trigger.new and trigger.old cannot be used in Apex DML operations.
- You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown.
- trigger.old is always read-only.
- You cannot delete trigger.new.
No comments:
Post a Comment