Legacy Archive
Use the schedule tab to archive Salesforce data
FEATURE RETIREMENT ALERT - EOL Dec 31, 2022
One or more features described here is part of a retirement. Please see the official GRAX Feature Retirement page for more information on this and other feature retirements.
Historically, GRAX placed much of the responsibility for creating, managing, and monitoring a healthy archive configuration and schedule on the users through the Salesforce package. GRAX has since moved to a web based Archive which simplifies the entire process into a workflow to archive one or more records. For more information, see the documentation above or contact GRAX Support.
When you click on the GRAX Schedule
tab, you may notice two sub-tab options: Backup
and Archive
. Here, let's focus on archives, which means GRAX backs up the records and then deletes them once confirming they are 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 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 is 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 is able to select any standard Salesforce report, and only the records in that report are backed up. We recommend the report option for more granular, fine-tuned backups.Advanced
: This option allows you to specify your own SOQL query. Again, filtering on non-indexed fields may lead to queries timing out. SOQL queries don't support sub-queries. 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:
- Report Name contains “GRAX” or the report is saved in a folder where the folder name contains “GRAX”
- 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”.
- We recommend only having 1 column in the report (Id)
- Salesforce imposes a heap size limit that GRAX runs into depending 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 5 AM.
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” are 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 includes 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 doesn't 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
FEATURE RETIREMENT ALERT
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 conducting an archive, you 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 requires the Bulk API Hard Delete permission for the GRAX integration user.
- Do Not Delete Parent : this archives all objects selected except for the root parent. This option comes 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 receive emails upon successful completion of the Archive. You 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
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 doesn't 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.
Updated about 2 months ago