function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SivaGSivaG 

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());
                }
             }
        } 
Best Answer chosen by SivaG
Krishna SambarajuKrishna 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.