This variable returns a list of the old version of sObject records. This list is only available in update and delete triggers.
trigger ApexTrigger on Opportunity (before update)
// Only available in Update and Delete Triggers
for(Opportunity oldOpp: Trigger.old)
for(Opportunity newOpp: Trigger.new)
if(oldOpp.id == newOpp.id && oldOpp.Amount != newOpp.Amount)
newOpp.Amount.addError(‘Amount cannot be changed’); // Trigger Exception
< < Previous
Next > >
The batch is going to start shortly. Fill the form given below to Register yourself now.
Fill the form below to get a demo of this course.
Online Salesforce Development Course is soon going to be launched. Please fill the form and we will notify you about the course.