---
title: "USE CASE: Selecting Account Deletion Criteria Using Rollup Helper | Data Quality Helper Use Case Library"
description: How to use Rollup Helper to rollup necessary information that will inform Storage Helper if the record(s) should be deleted.
image: https://www.passagetechnology.com/hubfs/2021/DQH-library.png
---

[GET DEMO](https://www.passagetechnology.com/any-product-one-on-one) **+1 (224) 655-6779

[![Trusted Salesforce service partner Passage Technology](https://www.passagetechnology.com/hubfs/2021/Nav-header-logo_PT.png) ](https://www.passagetechnology.com)

# USE CASE: Selecting Account Deletion Criteria Using Rollup Helper

[![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®.](https://www.passagetechnology.com/hubfs/2021/Essential-Salesforce-Guide_Helper-Suite.png) ](https://www.passagetechnology.com/en/essential-guide-for-salesforce-admins-developers)

## Problem: You want to set up the criteria in Data Quality Helper to automatically delete certain Accounts

For example, delete an Account if it has had no activity in several years.

## Solution: Use Rollup Helper to rollup necessary information that will inform Data Quality Helper if the record(s) should be deleted

First, you need to decide the exact criteria needed for New Data Cleanup Rule. In this example, we want to delete Accounts if no Contacts in that Account have engaged with us for five years.

In order to do this in Rollup Helper, first you will need to to note that in Salesforce an Activity consists of 2 different objects: Task and Event  
Since these are separate objects they will need to be rolled up separately, however it is still possible to get a final result in a single field using a formula field.

Before getting into Rollup Helper, you will first need to create 3 fields on both the Contact and Account Object:

- A date field to hold the Last Task Date
- A date field to hold the Last Event Date
- A formula field to return the most recent date of the 2. This formula will return a date value and can be called Last Activity Date. The formula will be as follows:  
  IF(  
  AND(  
  ISBLANK(Last_Task_Date__c),  
  ISBLANK(Last_Event_Date__c)  
  ),  
  NULL,  
  DATE(1900, 01, 01) +  
  MAX(  
  BLANKVALUE(Last_Task_Date__c , DATE(1900, 01, 01)) - DATE(1900, 01, 01),  
  BLANKVALUE(Last_Event_Date__c, DATE(1900, 01, 01)) - DATE(1900, 01, 01)  
  )  
  )

 

The above formula will return the larger of the 2 date values and will take into consideration blank values in case there is not a task or event attached to the record.

Once you have your fields created, you can create your Rollup Helper Settings. We will start with rolling up the Last Task Date for Contacts:

- Select Target Object *Contact*
- Select Target Field will be the *Last Task Date* field 
- Select Source Object will be *Task*
- The rollup Type will be *Max*. This will return the most recent value.
- The Relationship Field will be *Whoid*
- The Source Field can be *ActivityDate*, or whichever date field makes sense for your use case
- If you only want to include **closed** activities, phone call, emails, etc., you can use the create new filter button and define filter criteria in Step 3 of the filter
- Save and run your rollup

 

Rollup the Last Event Date up to Contacts:

- Select Target Object *Contact*
- Select Target Field will be *Last Event Date* field
- Select Source Object will be *Event*
- The rollup Type will be *Max*. This will return the most recent value.
- The Relationship Field will be *Whoid*
- The Source Field can be *ActivityDate*, or whichever date field makes sense for your use case
- Save and run your rollup

 

We will now make two more rollups, but up to the Account level, again starting with Last Task Date:

- Select Target Object *Account*
- Select Target Field will be the *Last Task Date* field 
- Select Source Object will be *Contact*
- The rollup Type will be *Max*. This will return the most recent value.
- The Relationship Field will be *Accountid*
- The Source Field can be *ActivityDate*, or whichever date field makes sense for your use case
- Save and run your rollup

 

Create the final rollup to move Last Event Date from Contact to Account:

- Select Target Object *Account*
- Select Target Field will be *Last Event Date* field
- Select Source Object will be *Contact*
- The rollup Type will be *Max*. This will return the most recent value.
- The Relationship Field will be *Accountid*
- The Source Field can be *ActivityDate*, or whichever date field makes sense for your use case
- Save and run your rollup

 

Finally, in Data Quality Helper, we can create the New Data Cleanup Rule:

- Click the button to create a New Data Cleanup Rule
- Select *Account* as the Object
- Decide if you want to Cascade Delete any of the Child Objects connected to the Account, such as the Contacts
- Create your filter criteria 
    - Select your newly created *Last Activity Date* formula field as the Field
    - Operator *greater than or equal*
    - Condition* Number of months ago *equals *60*
    - Save your New Data Cleanup Rule
- Preview the records to be deleted to confirm your filter choices
- Run the rule or schedule it for later

![UC-DQH_New Data Cleanup Rule](https://www.passagetechnology.com/hs-fs/hubfs/UC-DQH_New%20Data%20Cleanup%20Rule.png?width=1000&height=711&name=UC-DQH_New%20Data%20Cleanup%20Rule.png)

 

Need help setting up this use case?

[![Schedule Demo/Consult](https://no-cache.hubspot.com/cta/default/4130736/cf86c8e7-57d0-4596-af6c-780532d84bf9.png)](https://cta-redirect.hubspot.com/cta/redirect/4130736/cf86c8e7-57d0-4596-af6c-780532d84bf9)

[![Install Free App Now](https://no-cache.hubspot.com/cta/default/4130736/75b1670b-97a2-4c85-9ab3-99e04453aaf3.png)](https://cta-redirect.hubspot.com/cta/redirect/4130736/75b1670b-97a2-4c85-9ab3-99e04453aaf3)

Tags: [Rollup Helper](https://www.passagetechnology.com/data-quality-helper-use-cases/topic/rollup-helper), [Data Quality Helper](https://www.passagetechnology.com/data-quality-helper-use-cases/topic/data-quality-helper)

| [** USE CASE: Improving a Company’s Time-off Request Process in Salesforce ](https://www.passagetechnology.com/data-quality-helper-use-cases/improving-a-companys-time-off-request-process-in-salesforce) | [Data Quality Helper Use Case Library](https://www.passagetechnology.com/data-quality-helper-use-cases) | [ USE CASE: Deleting Old Chatter Follows to Stay Under Salesforce Limits ** ](https://www.passagetechnology.com/data-quality-helper-use-cases/deleting-old-chatter-follows-to-stay-under-salesforce-limits) |
| --- | --- | --- |

[ USE CASE: Ensuring All Salesforce Phone Number Fields Are Consistent in Format ](https://www.passagetechnology.com/data-quality-helper-use-cases/use-case-ensuring-all-salesforce-phone-number-fields-are-consistent-in-format)

[ USE CASE: Mass Delete Old, Unneeded Marketing Data (Clicks & Opens) ](https://www.passagetechnology.com/data-quality-helper-use-cases/mass-delete-old-unneeded-marketing-data)

[ USE CASE: Manage Storage Better by Recycling Unneeded, Archived Calls ](https://www.passagetechnology.com/data-quality-helper-use-cases/manage-storage-better-by-recycling-unneeded-archived-calls)

[ USE CASE: Streamline Storage of Automated Emails Used by Salesforce ](https://www.passagetechnology.com/data-quality-helper-use-cases/streamline-storage-of-automated-emails-used-by-salesforce)

[ USE CASE: Keep It Clean—Mass Delete Old Synced Tasks in Salesforce Org ](https://www.passagetechnology.com/data-quality-helper-use-cases/keep-it-clean-mass-delete-old-synced-tasks-in-salesforce-org)

[ USE CASE: Ensuring All Salesforce Phone Number Fields Are Consistent in Format ](https://www.passagetechnology.com/data-quality-helper-use-cases/use-case-ensuring-all-salesforce-phone-number-fields-are-consistent-in-format)

[ USE CASE: Finding and Fixing Duplicate Cases in Salesforce ](https://www.passagetechnology.com/data-quality-helper-use-cases/finding-and-fixing-duplicate-cases-in-salesforce)

[ USE CASE: Finding and Fixing Duplicate Opportunities in Salesforce ](https://www.passagetechnology.com/data-quality-helper-use-cases/finding-and-fixing-duplicate-opportunities-in-salesforce)

[ USE CASE: Ensuring Reasons Lost Are on Closed Salesforce Opportunities ](https://www.passagetechnology.com/data-quality-helper-use-cases/ensuring-reasons-lost-are-included-on-closed-lost-opportunities-in-salesforce)

[ USE CASE: Mass Delete Old Emails, Auto-Responses & Case Email Messages ](https://www.passagetechnology.com/data-quality-helper-use-cases/mass-delete-old-emails-auto-responses-case-email-messages)

© 2026 Passage Technology LLC All Rights Reserved. [Privacy Policy](https://www.passagetechnology.com/privacy-policy) | [Purchasing & Legal](https://www.passagetechnology.com/purchasing-and-legal) | [Terms of Service](https://www.passagetechnology.com/terms-of-service) | [App Security](https://passagetech.my.site.com/KnowledgeBase/s/article/Security-and-Privacy-Policy-1578080055496)

- [** ](https://www.facebook.com/passagetech)
- <https://x.com/passagetech>
- [** ](https://www.linkedin.com/company/passage-technology)
- [** ](https://www.youtube.com/channel/UCK2tzaCWVC7PmFCXrLirnZw)

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "John L. Duoba",
    "url" : "https://www.passagetechnology.com/data-quality-helper-use-cases/author/john-l-duoba"
  },
  "dateModified" : "2025-03-13T20:41:46.639Z",
  "datePublished" : "2024-12-31T19:48:06.000Z",
  "headline" : "USE CASE: Selecting Account Deletion Criteria Using Rollup Helper",
  "image" : [ "https://www.passagetechnology.com/hubfs/2021/DQH-library.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://www.passagetechnology.com/data-quality-helper-use-cases/account-deletion-criteria-using-rollup-helper",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.passagetechnology.com/hubfs/Logo%20PT_colors_wide_on-white.png"
    },
    "name" : "Passage Technology LLC"
  }
}
```