[英]System.FinalException: SObject row does not allow errors
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
我正在尝试更新那些受影响的机会的帐户,并在获取DMLException之后,代码进入catch块,我得到了
'System.FinalException: SObject row does not allow errors' at row a.Id.addError(de.getMessage());
'System.FinalException:SObject行不允许错误'在a.Id.addError(de.getMessage())行中;
Please let me know what is wrong with the line a.Id.addError(de.getMessage()); 请让我知道a.Id.addError(de.getMessage())行出了什么问题;
if (acctLst.size() > 0) {
try{
update acctLst;
} catch(Exception de) {
for (Account a : acctLst) {
a.Id.addError(de.getMessage());
}
}
}
您正在尝试将错误添加到sObject字段 a.Id
但应将错误添加到sObject中,就像这样
a.addError(de.getMessage());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.