Achieve your business goals faster by unlocking our Salesforce Cloud Services.
A map of IDs to the old version of the sObject records.
trigger ApexTrigger on Opportunity (before update) {
// Only available in Update and Delete Triggers
Map<Id,Opportunity> oMap = new Map<Id,Opportunity>();
oMap = trigger.oldMap;
for(Opportunity newOpp : trigger.new)
{
Opportunity oldOpp = new Opportunity();
oldOpp = oMap.get(newOpp.Id);
if(newOpp.Amount != oldOpp.Amount)
newOpp.Amount.addError(‘Amount cannot be changed’); // Trigger Exception
}
Note: This map is only available in update & delete triggers.
< < 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 Result
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.