Archive

Within the Schedule tab, you can use the Archive tab to create and schedule complex archive scenarios for a parent along with selected children.

🚧

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

Introduction

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.

Creating an Archive

📘

Click here for more information on navigating around the Schedule tab and understanding the options for creating, viewing, editing, and taking other actions on backup and archive jobs.

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. Always follow Salesforce best practices for querying and indexing

🚧

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

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.

❗️

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

📘

Maximum Hierarchy Levels

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.

Archive Options

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 (BETA) : 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.
    This feature is currently in Beta and you should contact GRAX Support to have this enabled.

  • 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. It can be a bit complex to understand exactly how this works and sample use cases, so please click here for more information if this feature is relevant.

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:

IF(

text(LeadType__c) = "MQL",

DATE(1920,1,1),

DATE(2500,1,1)
)

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.

Video Walkthrough