Count Contact Records With A Filter Applied

Share

Free Salesforce business guides to help admins/developers, project managers, sales managers, and decision makers. Download the free PDF series now: Reinventing Your Business, Reimagining Your Salesforce®.

Problem

You need to display a count of the total records that meet some condition on the parent, and Rollup Summary Fields are NOT an option. For example, you may get asked, "How many VP Contacts do I have on any given Account?"

Solution

Create a new custom field (using Number as the data type) on the object you want the results to reside, in this case Account. We named the field, "# of VPs."

To create the rollup:

  • Select Account as the Target Object
  • Select "# of VPs" as the Target Field
  • Select Contact as the Child Object
  • Use Account ID as the relationship field
  • Select Count as the Type of rollup. Note: IsDeleted is the default source field used for count rollups since it is a simple boolean field that exists on all records.
  • Create a new filter
    • Name the filter in step 1, then skip to step 3
    • In step 3, select the "Title" field
    • Select "Contains" as the operator
    • Enter "VP" for the criteria
      Count Contact Records Filter
  • Save your filter, and then save and run the rollup

Count Contact Records Rollup

 

USE CASE: Creating Account Hierarchy Rollups without Coding Rollup Helper Use Case Library Total Sales (from Invoices or Opportunities)