简体   繁体   English

System.FinalException:SObject行不允许错误

[英]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.

相关问题 OppRecordCombo:执行 BeforeUpdate 引起:System.FinalException:SObject 行不允许错误() - OppRecordCombo: execution of BeforeUpdate caused by: System.FinalException: SObject row does not allow errors () 在共享服务器上发布时,获取“System.Security.SecurityException:该程序集不允许部分受信任的调用者” - Getting “System.Security.SecurityException: That assembly does not allow partially trusted callers” when published on shared server 为什么setInterval()会忽略错误? - Why does setInterval() ignore errors? 为什么TestNG允许多个预期的例外? - Why does TestNG allow several expected exceptions? Python asyncio 不显示任何错误 - Python asyncio does not show any errors linux系统错误引发C ++异常 - Throwing C++ exceptions from linux system errors 向Windows防火墙添加程序例外仍然不允许连接 - Add Program Exception to Windows Firewall still does not allow connections Scala中的@throws不允许调用Java来捕获正确的异常类型 - @throws in Scala does not allow calling Java to catch correct exception type JavaScript / NodeJS是否会自动引发错误? - Does JavaScript / NodeJS automatically throw Errors? python try除了不能捕获所有错误 - python try except does not capture all errors
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM