Salesforce Platform Developer I Certification Guide
上QQ阅读APP看书,第一时间看更新

Rollup summary fields 

A rollup summary field (RUS) field is very much like a formula field in that it also performs a calculation. However, this is based on child records, and only when these child records are part of a Master-Detail relationship!

It's used to summarize a numeric value based on (filtered) child records and can perform COUNT, SUM, MIN, and MAX.

It is recalculated whenever a transaction on these child records occurs in the following ways:

  • When a new child is created
  • When one of the children gets updated
  • When a child gets deleted

You can use filters to only pull values from specific child records. For example, let's say that we have a custom Invoice__c object that is related to the account as a Master-Detail relationship. In our Invoice__c object, we have an Amount field and a Status field. We could create a RUS field in the account that represents the total amount that is overdue, which is a calculation of the SUM operation of the Amount field on all related invoices, with a filter on the Status field that is equal to Overdue.

RUS performs an update of the record they reside in and can, therefore, be used to fire off other automation tools, such as WFRs, Process Builders, and more.