Use the schedule tab to archive Salesforce data


One or more features described here may be part of a retirement. Please see the official GRAX Feature Retirement page for more information on this and other feature retirements.

When you click on the GRAX Schedule tab, you will notice two subtab options: Backup and Archive. Here we will focus on archives, which means GRAX will back up the records and then delete them once confirming they were successfully backed up.

Be sure to also read through archive best practices before you run your first archive.

Creating an Archive

Let's take a look at some key considerations within the Archive creation screen:

  • Select the main object that you want to backup/archive (it is important to remember that this is the “parent object” in the backup/archive process that you are creating, and is the object you can filter on. Any children selected will include ALL child records related to whichever parent records are queried).
  • Select your filter criteria. Select one of the options below:
    • Date: When this option is selected the user will be able to select any “date” field on this object and then select target dates of which records you want backed up/archived. Always try to choose an indexed field for better performance.
    • Report: This option allows much more flexibility in selecting which records you want backed up since you can base it on a report, but the downsides are that it supports fewer records (see warning below). When this option is selected, the user will be able to select any standard Salesforce report, and only the records in that report will be backed up. We recommend the report option for more granular, fine-tuned backups.
    • Advanced: This option will allow you to specify your own SOQL query. Again, filtering on non-indexed fields may lead to queries timing out. SOQL queries do not support sub-queries. Always follow Salesforce best practices for querying and indexing.

Screen Shot 2021-06-22 at 11.33.14 am.pngScreen Shot 2021-06-22 at 11.33.14 am.png

Using the Report Filter Criteria

When creating your report to be used in the backup process, you need to make sure the report meets these conditions:

  1. Report Name contains “GRAX” or the report is saved in a folder where the folder name contains “GRAX”
  2. The first column in the report is the “object id”. For example, on an Account report the first column in the report needs to be “AccountId”.
  3. We recommend only having 1 column in the report (Id)
  4. Salesforce imposes a heap size limit that GRAX will run into, based on how large the report is. Typically we recommend you keep these reports to a single column (ID column) and ensure they are less than 250,000 records.


Here we're using a report we created as the basis for our backup job

Screen Shot 2019-08-13 at 7.03.48 AM.pngScreen Shot 2019-08-13 at 7.03.48 AM.png

Example schedule running daily at 5AM.

Review Hierarchy

Review your object hierarchy and the related records which you want to back up with the parent object. Any object with the checkbox “checked” will be backed up as part of this process.


Best Practices

Please review archive best practices and understand your object model to prevent data loss via things like cascade deletes.

Maximum Hierarchy Depth

GRAX supports selecting up to 3 hierarchy levels (parent, child, and grandchild) for most objects. If selecting chatter in the hierarchy, you can go 5 total levels, since this will include FeedItem and FeedComment.

Run the Archive Estimate

Once you are satisfied with the configuration you can run the Archive Estimate to validate that these criteria capture the amount of top level objects that you are expecting. This is the "top-level" object and does not include counts of the related objects that would be included in this Archive. For that level of detail, use the "Delete Data" Archive Option set to Off and run the Archive as Dry Run.

Screen Shot 2021-06-22 at 11.14.45 am.pngScreen Shot 2021-06-22 at 11.14.45 am.png

Archive Options


One or more features described here may be part of a retirement. Please see the official GRAX Feature Retirement page for more information on this and other feature retirements.

Screen Shot 2021-06-22 at 11.24.01 am.pngScreen Shot 2021-06-22 at 11.24.01 am.png

When conducting an archive, you will also have the following options:

  • Delete Data : This option allows a GRAX user to run the full Archive job without performing the delete step, essentially providing a "Dry Run" of this job. When complete, the user can view the Summary Link to get the complete counts of records that have been backed up as part of this Archive, hence these are the counts of records that would be archived. This is an excellent final check before launching a new archive.
  • Delete by API : This is the recommended way to delete with GRAX. This flag allows you to move the delete operation from being executed within Salesforce to being managed by the GRAX engine using the Salesforce API. This enables deletes using the Bulk API, which dramatically increases the performance of the delete step in the archive process. This will require the Bulk API Hard Delete permission for the GRAX integration user.
  • Do Not Delete Parent : this will archive all objects selected except for the root parent. This option will come in handy in certain scenarios where you want the effect of filtering across objects. For example, let's say you want to archive all cases related to inactive Accounts (you want the Accounts backed up, but not deleted). One way to do this would be a hierarchy process on the Case object, and use a formula field workaround to find related inactive Accounts. However, with this new toggle enabled, you can create a hierarchy process on the Account, and select Cases as a child. All objects are still backed up to GRAX; this toggle simply controls the parent/root object not getting deleted as well.
  • Notify User via Email when Process Completes: Set this switch to On and you will receive emails upon successful completion of the Archive. You will receive notifications of any error states regardless of the setting on this option.
  • Rolling Date : The rolling date setting can be helpful for recurring archives where you want the Start and End Dates to roll forward by the amount of the Schedule frequency that you set. For most scenarios, we recommend instead using the SOQL option along with the officially supported date literals which can be found here.

Appendix: Date Formula Field

As described in the above guide, we recommend NOT using the Report option for large data sets. Instead, we recommend creating a Date Formula field on the relevant object and using that as a flag field for your hierarchy process criteria.

For example, let's say you want to do a large hierarchy process for all Leads where Type = MQL. Instead of using a report, we would create a Formula field (Date Type) on the Lead object that looks something like this:

Sample Date Formula Flag Field

  text(LeadType__c) = "MQL",

Note that the outputs of this formula field are arbitrary and just used to signify TRUE or FALSE. You could use any arbitrary dates you want. So in the example above, in our GRAX Hierarchy Process we would want to look for all Leads where this date formula field = 1/1/1920.

Formula Field Logic

Salesforce does not index formula fields so if your GRAX process is based on a formula (date) field instead of an indexed field such as CreatedDate, LastModifiedDate etc., please be sure that the underlying formula has best practices. For instance, try to use an actual date output instead of outputting null.