- Ranchi, Jharkhand, India
- hr@nubetree.com
A map of IDs to the old version of the sObject records.
This map is only available in update & delete triggers.
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
}
}
}
We design tailored systems that grow with your business, ensuring flexibility, efficiency, and long-term success.
Our company has a team of certified experts with years of experience and a strong passion for technology.
Stay connected for the latest updates, tips, and exclusive content!
Copyright 2024. All rights reseved by NubeTree.com