You need to sign in to do that
Don't have an account?
dinesh jain
execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow
trigger restrictHindiTeacher on Contact (before Insert, before Update) {
List<Contact> conNewList = trigger.new;
List<Contact> conOldList = trigger.old;
if(conNewList[0].subjects__c == 'hindi'){
conNewList[0].addError('Teacher REstricted');
}else if(conOldList[0].subjects__c == 'hindi'){
conOldList[0].addError('Teacher REstricted');
}
}
This code is working when I add subject hindi to picklist but doesn't work when remove hindi from piicklist.
Means is working while trigger.new but not while trigger.old