Count the number of related child records using a Rollup field

Its going to be a very simple and basic blog where i will show you how you can count number of related records for e.g.

  1. number of cases related to account/contact
  2. number of opportunities related to account/contact
  3. number of active quotes for a contact

this list can go one. In short wherever you have 1:N relationship ; you should be able to perform this operation. it will show something like below :



  1. To do this create a field on parent record – select the name and select the data type as “whole number” and  field type as “RollUp”  :2
  2. after doing this as soon as you click on “edit” – it saves the field and give you an editor , just like a business rule select the cases(customer) as a related entity.
  3. you can define condition below that for e.g where status of the case  = active or where cases owner is a particular user.
  4. finally in the Aggregation select “COUNT” and in the next field it will show you just one option as case.
  5. finally save the editor and put this field on the form. When you open the form after the publishing all customization , you might see this as 0 at first place its because rollup fields are nothing but system jobs in the background which runs at particular time ( 12 hours to be specific) but you can always force it by clicking to that refresh button in the field :

once all done you will have this field showing you the related records count.


i hope this helps!