Rollup Summary field is a read only field which is used to calculate the count of child records, Sum, Minimum, Maximum of a field on the child object. It is enable for master in Master – Detail Relationship.
- Roll-Up Summary field means working on the child object.
- Rolling up the child records and computing the value on the Parent record.
- Rollup Summary Field can not be created in lookup relationship.
- Using Apex Trigger we can create Rollup Summary field in Lookup relationship.
In Salesforce.com, we can make four function to work with Rollup Summary field. They are
- Count – Number, Currency.
- Sum – Number, Currency.
- Minimum – Number, Currency, Date.
- Maximum – Number, Currency, Date.
Here we are going to create field(Rollup Summary field) on the parent record(Pharma product). To create Rollup Summary Field in Salesforce go Setup | Build | Create | Objects | Pharma Product | Custom Fields & relationships | New.
- Select the Data type as Roll-Up Summary as shown above. Now click on next button.
- Enter Field label and field name as shown above and click on next button.
Defining the summary calculation.
It displays list of all child object for the pharma product. If any child object is related to pharma product via lookup relationship it can not be listed here.
- Select Sample object as Summarized object.
- Now select Roll-Up type
- Select filter criteria.
- Select the field to be aggregated.
- Click on Next button.
Here in this Salesforce tutorial we are calculation the total number of the Samples. Click on Sum as shown above.
As shown above we have successfully creates Roll-Up Summary field in Salesforce.
- Now go to Pharma product object and click on any records.
As shown above we have 4 sample records and the total sample quantity is 150.