You need to sign in to do that
Don't have an account?
SivaG
System.FinalException: SObject row does not allow errors
Hi,
The below code snippet is in Opportunity afterUpdate trigger. I am trying to update the accounts of those affected opportunities and after getting DMLException, the code enters catch block and I get 'System.FinalException: SObject row does not allow errors' at row a.Id.addError(de.getMessage());
Please let me know what is wrong with the line a.Id.addError(de.getMessage());
if(acctLst.size()>0){
try{
update acctLst;
}
catch(Exception de){
for (Account a : acctLst) {
a.Id.addError(de.getMessage());
}
}
}
The below code snippet is in Opportunity afterUpdate trigger. I am trying to update the accounts of those affected opportunities and after getting DMLException, the code enters catch block and I get 'System.FinalException: SObject row does not allow errors' at row a.Id.addError(de.getMessage());
Please let me know what is wrong with the line a.Id.addError(de.getMessage());
if(acctLst.size()>0){
try{
update acctLst;
}
catch(Exception de){
for (Account a : acctLst) {
a.Id.addError(de.getMessage());
}
}
}
Best Answer chosen by SivaG
Krishna Sambaraju
You are trying to add the error on the account object from the Opportunity trigger. That is the reason you are getting the error. Try throwing the error on the corresponding opportunity.