In this blog we are going to learn about Roll-Up Summary Field In Salesforce. Roll-Up summary field is used to display sum, maximum or minimum value of field in related list. It can also be used to count the number of records in related list. It is a read-only field.
Example
Let’s create an example. Suppose you have two custom object Product and Rating . Rating is child object of custom object Product. The relationship between these two object is master detail relationship. Now, you want to show the average rating of the product based on associated rating.
Steps to create above example:
Step1: Create two custom objects Product (API name : Product__c) and Rating(API name : Rating__c)
Step2: Create a custom field Product( API name : Product__c) of field type Master Detail Relationship and choose master object Product (API name : Product__c) in Rating(API name: Rating__c).
Step3: Create another custom field value(API name : Value__c) of number type
Step4: Now you need to create two roll up summary field and one formula field to display the average rating in custom object Product (API name : Product__c) .
1. Create first roll up summary field of type sum which display the total sum of rating value. Let’s say field name is Total rating(API name :Total_rating__c).
2. Create second roll up summary field of type count to get the total count of rating. Let’s say field name is Rating Count(API Name :Rating_Count__c).
3. Create a formula field with field name Average rating(API name : Average_rating__c) by using below mentioned formula to show the average value of rating of the product.
Formula(Number) : Total_rating__c / Rating_Count__c
That’s all, you are now ready to rate your product. Now go and add product and its rating and see the result.
Support
That’s all about roll up summary field in salesforce, still if you have any further query, feel free to contact us, we will be happy to help you
https://wedgecommerce.com/contact-us/