Roll-up fields

A roll-up is a special kind of field that is allowed only on a master object—that is, objects that are on the master side of a master–detail relationship. These fields are used to summarize child fields, such as getting the number of case details parented to a given Case, or getting the total amount of invoice records related to an Account.

Let's take our Case Detail object and add a new custom field called Invoice Amount with the Currency type, as shown in the following screenshot (you should already have the necessary skills to set up this configuration):

Case Detail fields

Let's get back to the Case object (the master of the relationship) and create a new Roll-up Summary field called Number of details that should show up the number of details related to the current Case:

The roll-up field counts the number of child objects

We are selecting the COUNT roll-up type and applying a filter so that only case detail records with an amount greater than 0 are selected.

Let's create another roll-up field named Total Amount that sums up all the Case Detail Invoice Amount fields (using the SUM roll-up type with no filter).

Lastly, let's create a new roll-up field called Maximum Amount that should display the highest amount among the children objects (let's use the MAX roll-up type).

Create a new Case and some related children with different Invoice Amount values. You should get a result like the following:

Roll-up fields on the Case object

After a few Case layout changes to better highlight the required information, we can see four case details with different Invoice amount values (sorted by this value), as well as the following:

  • Number of details is 3: We have an invoice with an Invoice Amount of € 0
  • Maximum Amount is € 50,000
  • Total Amount is € 51,100: This is the sum of all invoices, irrespective of the amount

All the calculations are done by the platform in the background.

There is a limitation: if you delete a child record, roll-up fields are not recalculated automatically. For this, you should use the Force a mass recalculation of this field option in the Edit wizard of the roll-up field.

As a general rule, calculating a new roll-up field can take up to 30 minutes.

You can have up to 25 roll-up fields per object (refer to the Object Limits links on the Object Manager).

Take care when using roll-up fields and setting up their field-level security. If a user doesn't have access to a child record's field used in a master record's roll-up field, the calculated value is shown anyway despite FLS settings.

We can create special roll-up fields on standard objects, such as Account (rolling up to opportunities) or Opportunity (rolling up to opportunity products).

For further details and the limitations of roll-up fields, refer to Salesforce Help at https://help.salesforce.com/articleView?id=fields_about_roll_up_summary_fields.htm&type=5.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.201.17