Archive Scenarios

Recommendations for the most common types of archives

IMPORTANT
Before you can archive data you must enable Auto Backup. Archiving data is dangerous because Salesforce cascade deletes or triggers can delete related records in unexpected ways. Auto Backup is the best protection to guarantee all deleted data, from GRAX archives or from any other SFDC delete procedure, is already in GRAX.

Deleting data from Salesforce without impacting your data set and end user experience is a challenging topic. Due to the complex nature of SFDC data, schema, and relationships, and validation rules it becomes increasingly complex to archive and restore object the higher in the data model hierarchy you go.

As an example, deleting / archiving a single Account record might be impossible. Deleting the Account record will cascade delete many other records in the master-detail relationship. But many other objects in SFDC will reference the account and its children so the SFDC API won't let you delete the record by any means until you update or delete these other objects.

For this reason we strongly recommend breaking your archive plan down into small pieces and working from the bottom up of your data model. For standard SFDC objects we recommend configuring archives jobs in this order:

  1. EmailMessage + Attachments
  2. Task
  3. Case
  4. Opportunity

Inversely we strongly discourage trying to archive data top down, such as expecting an Opportunity archive to clear out all cases, tasks, and email messages below it. Chances are you'll hit validation errors and only partially delete the data you want.

In summary:

  • Use GRAX Auto Backup to back up everything so GRAX will have a version of your SFDC data deleted by any means
  • Archive data from the bottom up
  • Use the GRAX Embedded Experience to show archived data to you end users in SFDC

EmailMessage and Attachments to reduce SFDC storage

The simplest and most effective archive is EmailMessage and Attachments.

Most SFDC users will see the vast majority of SFDC object storage coming from the EmailMessage object and file storage coming from related attachments. EmailMessage is also at the bottom of the data hierarchy so there are little to no relationships that cause validation errors on deletion.

Therefore we recommend:

  • configuring an archive for EmailMessage only
  • leaving Case, etc. objects in SFDC and using the GRAX Embedded Experience to display archived email messages on Case records in SFDC

To do so, first validate basic archive and restore functionality:

  • Use "Archive by SOQL" to select the oldest EmailMessages
    • SELECT Id FROM EmailMessage ORDER BY CreatedDate ASC LIMIT 1
  • Use the "Delete orphaned files" default option
  • Validate archiving and restoring 1 EmailMessage to understand the tools and to expose any permission problems deleting and inserting a single record in Salesforce.

Next, archive many email messages to reduce storage:

  • Use "Archive by SOQL" to target a bigger set of EmailMessages
    • SELECT Id FROM EmailMessage WHERE CreatedDate < 2019-01-01T00:00:00Z
    • SELECT Id FROM EmailMessage WHERE CreatedDate != LAST_N_DAYS:731

Archive Task Hierarchy

Another simple and effective archive is Task for both storage savings and to delete old records for data compliance reasons. Many SFDC users will have Task records from years in the past that no longer need to be retained as live records in SFDC.

Therefore we recommend:

  • Configuring an archive for Task only
  • Leaving Case, etc. objects in SFDC and using the GRAX Embedded Experience to display archived Task on a Case record in SFDC

To do so, first validate basic archive and restore functionality:

  • Use "Archive by SOQL" to select the oldest Task
    • SELECT Id FROM Task ORDER BY CreatedDate ASC LIMIT 1
  • Validate archiving and restoring 1 Task to understand the tools and to expose any permission problems deleting and inserting hierarchical data in Salesforce.

Next, archive many Tasks to remove old data:

  • Use "Archive by SOQL" to target a bigger set of Cases
    • SELECT Id FROM Task WHERE CreatedDate < 2019-01-01T00:00:00Z
    • SELECT Id FROM Task WHERE CreatedDate != LAST_N_DAYS:731