Roll-Up Summary Fields In Salesforce

HELLO Salesforce Thinkers, In our previous blog we learned about Search Layouts in Salesforce, In this blog we are going to learn about “Roll-Up Summary Fields In Salesforce”.

A roll-up summary field calculates values from related records.

Roll-up summary field can only be created on the master object in a Master detail relationship.

We can create a roll-up summary field to display a value in a master record based on the values of fields in a detail record.

Roll up summery fields are available for all the custom master-detail relationships and some specific standard relationship such as Opportunity – Product, Account – Opportunity and campaign – Campaign members.

For example, Total cost of products on an opportunity. Opportunity and product have standard relationship between them.

Roll up summery field are available on Page layouts, related list ,views and reports.

Roll-up summary field has the following functions:

  • Count()
  • Min()
  • Max()
  • Sum()

Roll-up summary field functions:

Count():

Count displays the record count. It calculates the number of child records in the master-detail relationship.

Min() :

Min calculates the least values for a specified field on the child records. Number, currency, percent, date and date/time the fields are available for Min calculations.

Max() :

Max calculates the highest values for a specified field on the child records. Number, currency, percent, date and date/time the fields are available for Max calculations.

Sum() :

Sum Calculates the sum of the values of a specified field on child record. Number, currency and the percent fields are available for sum calculations.

How to create a roll up summery field?

Let’s create an example, we have two custom objects Course and Student Information. Student Information is a child object of Course. The relationship between these two object is master detail relationship. Now, we want to show the Number of Students from Student Information Object.

Steps to create above example:

Step 1: Create two custom objects Course and Student Information.

Step 2: Create a custom Master Detail Relationship field Name “Course” and choose master object as Course in Student Information.

Step 3: Now we will create a roll up summary field “Number of Student” of type Count which display the total Count of Student.

NAVIGATE TO

Setup >> Object Manager >> Course >> Field & Relationship >> New >> Roll Up Summery >> Enter the Label and click Next.

Select object to summarize.

Select Roll-up Type, and the field to aggregate.

Set Filter Criteria if required.

Click Next, Next and Save.

That’s all, now we will create students records with their Course and see the result.

From here we can see the “Number of Students” in course BCA.

Considerations:

  • We can create max 25 roll up summery fields on an object.
  • Formula fields that include related object merge fields are not allowed in roll-up summary fields.
  • Formula field that references a dynamic date function such as Now(), and Today() are also not allowed in roll-up summary fields.
  • When we delete a child record on a roll-up Summary field, Salesforce doesn’t recalculate the value of the field. We can select the “Force a mass recalculation of this field” option on the edit page of the roll-up summary field to manually recalculate the value.
  • We can’t use long text area, multi-select picklist,description fields, system fields like, Last Activity, cross-object formula fields, and lookup fields in the field column of roll-up summary filters.
  • Auto number fields are not available as the field to aggregate in a roll-up summary field.
  • After you have created a roll-up summary field on an object, you cannot convert the object’s master-detail relationship into a lookup relationship.
  • Roll-up summary fields are not available for mapping lead fields of converted leads.
  • We can use roll-up summary fields in validation rules but not as the error location for our validation.
  • When you refer to a roll-up summary field in a list view or report, you can’t use certain qualifiers, including: Starts with Contains, Does not contain, Includes, Excludes and Within.

Thank you for reading…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s