triggers - MDR 澄清

标签 triggers relational-database salesforce apex-code

设置:

我有如下所示的 MDR 关系:

事件 --< 与会者 >-- 联系人

EVENT 上有一个触发器,在插入之前和更新之前触发,计算出席者人数(通过搜索出席者对象中事件 ID 的出现次数。

问题:

当我向参加者添加记录时,为什么我的触发器在 EVENT 对象上被触发?!

谢谢!

最佳答案

当对详细记录(在主从关系中)的更改导致主记录上的汇总摘要发生更改时,可能会导致主记录上的触发器执行。


The Roll Up Summary Field Technology Overview Salesforce 帮助中的知识文章对此进行了很好的解释:

Incremental Updates
When a summarized record changes we determine whether that change would lead to a change in the RSF value. If so, we calculate a delta value, which is then applied to the RSF in the summarizing record in the same transaction. We perform this operation in memory. No additional database call is required. Updates are only performed for the row(s) with RSF that actually changed. If the summarizing row itself is summarized the process continues to the grandparent. All validations, triggers, workflow, etc, for the summarizing row are necessarily executed when they are changed. All Incremental updates are performed to 38 digits of precision.

此外,请参阅 Spring '09 release notes 的第 79 页了解更多详情。

Workflow Rule and Roll-Up Summary Field Evaluations
The Spring '09 Workflow Rule and Roll-Up Summary Field Evaluations update affects the way Salesforce evaluates workflow rules and roll-up summary fields on objects with Apex triggers. The update improves the accuracy of your data and prevents the reevaluation of workflow rules in the event of a recursion. A recursion is a situation in which a part of your custom logic (such as a roll-up summary field or Apex trigger) causes Salesforce to execute the logic twice when saving a record, often resulting in undesirable behavior. For more information, see "What is the Spring '09 Workflow Rule and Roll-Up Summary Field Evaluations Update?" in the Salesforce online help.

关于triggers - MDR 澄清,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10640454/

相关文章:

c# - 插入触发器 SQL 之前

MySQL数据库触发器无法正常工作

database - 5场复合PK vs代理PK

mysql - 导轨 : Trouble with has many through relationships

php - MySql - 一对多关系

java - Oauth 刷新 token salesforce 流程简化

wpf - 触发 ScrollViewer 的滚动条可见性 (WPF)

sql-server - Postgresql 触发器通过 ODBC 将数据写入 SQL Server?

machine-learning - kNN 中的特征选择和重要特征

java - 通过json内的rest api发送pdf数据