Account Deletion Criteria Using Rollup Helper and Storage Helper

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 want to set up the criteria in Storage 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 Storage Helper if the record(s) should be deleted

First, you need to decide the exact criteria needed for Storage Helper. 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 Storage Helper, we can create the recycle job:

  • Create new Storage Recycle Job
  • 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
    • 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 Storage Recycle Job

 

Need help setting up this use case?

One-On-One Demo/Training Signup

Score Records on any Salesforce Object with the Helper Suite Helper Suite Use Case Library Create Sales Rep Reporting Using Rollup Helper and Lookup Helper
Chat Offline
Contact Us Here