Answer
A roll-up summary is a feature that summarizes all the child records. For example, it can calculate the maximum of a number or the latest date of a child record, the minimum of a number or the oldest date of the records, or sum up all the supported numerical values of the child records, with or without filters. A roll-up summary can be used only if there is a relationship from the child object to a parent object.
The roll-up summary is a read-only field located on the master record, which is sometimes referred to as the parent record. The relationship must be a master-detail relationship. However, if there is no master-detail relationship, you can create a field that behaves like a roll-up summary using Apex or Flow Builder.
Scenario
You are managing an online learning system with two custom objects:
- Parent Object:
Course__c
- Child Object:
Assignment__c
Requirement:
You want to display the total number of assignments associated with a course on the course record.