Skip to main content
All CollectionsSalesforceSalesforce Data Archiver
Configure Salesforce Data Archiver
Configure Salesforce Data Archiver
Updated over a week ago

Salesforce Data Archiver settings are stored as an Archival Set, which contains the following information:

  • Project details

  • Schedule and Retention

  • Salesforce Object Query Language (SOQL) queries to select data

  • Notifications

  • Validations that you want to bypass

Before you begin

Ensure that you have the appropriate license for Salesforce Data Archiver. For details, see Licensing Details.

If you don't see the Data Archiver tab, additional configuration is required.

Configure Salesforce

If you are a new customer installing the Salesforce App from Salesforce AppExchange, no additional steps are required. The Salesforce App managed package installation process sets the desired permissions for the standard profiles, such as System Administrator, Standard User, etc.

If you are already using the Salesforce App, you may not see the Data Archiver tab if you upgrade the managed package installed from Salesforce AppExchange. The reason is that Salesforce does not allow updating permissions for the standard profiles, such as System Administrator, Standard User, etc. at the time of upgrade.

You need to manually configure the permissions for the Salesforce environment, using any of the two ways:

  1. Reinstall the managed package

  2. Update the permissions for the profile manually.

Reinstall the managed package

Instead of upgrading the managed package, do a reinstall.


πŸ“ Note

Reinstallation will not delete any existing data or configuration. It will only update the permissions.


After this step, you will see the Data Archiver tab in the Salesforce App.

Updating the permissions manually

Procedure

  1. Log in to the Salesforce environment and go to Settings.

  2. On the Quick Find search box on the left-hand side, start typing Profiles and select the profile you want to use for Salesforce Data Archiver.

  3. Select Apex Class Access and click Edit

  4. Add the DataArchivalAuraController class and click Save.

  5. On the Quick Find search box on the left-hand side, start typing Profiles and select the profile you want to use for Salesforce Data Archiver.

  6. Type Data Archiver in the profile's search box, click Edit, and change the Tab Settings to Default On.

External Resources

Create an archival set

Click Data Archiver and click New Archival Set on the Salesforce App console. Follow steps 1 through 5 to create a new Archival Set.


πŸ’‘ Tip

You can create as many archival sets as you need.


Step 1. Archival set basic details

New_archival_set_01

Option

Description

Project

Select the project that you want to use for archival.

To learn more about projects, see Creating Projects.

Region

The storage region for the archived data cannot be changed because it is defined at the project level.

To learn more about projects, see Creating Projects.

Source Organization

Select the organization containing the records you wish to archive.

Archival Set Name

The archive set name is automatically generated, but it can be edited.

Step 2: Specify the schedule and retention period

Query_Builder_02

Use the Schedule and Retention tab to configure when the data archival will be executed and how frequently it will be repeated.


πŸ’‘ Tip

You can execute an archival task manually if you do not wish to wait for the scheduled job to run. For more information, see Trigger Manual Archival.


Option

Description

Scheduling Frequency

You can set the frequency to one of the following:

  • Daily

  • Weekly - Additionally, select the weekday

  • Monthly - Additionally, select the day of the month


πŸ“ Note

If you select Monthly, you can choose a day from 1 to 28.


Start Day and Start Time

You can schedule the first run using the date and time selector.


πŸ“ Note

The time zone is the same as defined in the Salesforce organization.


Retention

The retention period can be anywhere between 1 and 10 years. You can also select forever.


πŸ“ Note

You will not be able to change the retention period after creating the archival set. If you need the Retention later, contact Support.


Step 3: Select records to be archived

Use the Archival Content tab to configure the objects you want archived. In other words, create SOQL (Salesforce Object Query Language) query to select the records you want to be archived for each object.

Procedure

  1. In the Select Archival Content field, select the required object for defining the archival content query.
    The Define Query section is displayed.

    define_query.png
  2. Specify the where clause of your query, archive when condition and the records limit.
    For more details, see Using the archival content configuration.

  3. Specify advanced configuration, such as the fields you want to exclude, index fields, and child objects.
    For more information, see Advanced configuration.

  4. Optionally, preview the records selected by this query.
    For more information, see Preview Records.

  5. Repeat steps 1 through 4 until all the objects required to be archived are configured.

Using the archival content configuration

QueryBuilder_SOQLE.gif

The archival content configuration creates the where clause of the SOQL query and records limit. Specifying individual fields is unnecessary, as all the fields will be archived.


πŸ“ Note

By default, all the fields will be selected. If you want to exclude specific fields, see Advanced Configuration.


After selecting the object, the archival content configuration offers two ways to choose the records you want to archive:

  • Query Builder - Use the basic query builder to use a simple interface to build the where clause of SOQL query.

  • SOQL Editor - Use the editor to write the where clause and record limit using SOQL syntax. You can also copy the query from the Query Builder option by clicking copy from query builder icon.

Archive When

Option

Description

Archive When

You can archive the selected object by selecting one of the two options:

  • All conditions are met - Selecting this option specifies AND operator to all the conditions that the user configures.

  • Any condition is met - Selecting this option specifies OR operator to all the conditions that the user configures.


πŸ“ Note

If you add a subgroup to a group, the Archive When option is applicable to all the conditions within the subgroup.


Records Limit

Option

Description

Records Limit

Select the maximum number of records you wish to retrieve using the query.


πŸ“ Note

You will be able to preview only a maximum of 500 records. If you have more records, all those records will be archived. For more details, see Preview Records.



πŸ’‘ Tip

The maximum number of records archived will be determined by the records limit set in this step.


Configuring Fields

QueryBuilder_Config_fields.gif

The following options are available for each field you add:

Option

Description

Field Name

The field names are available based on the object selected.

Operator

The operators are available based on the data type of the selected field.

  • If you select a Date Time field, the operators available will be as follows:

    • older than

    • greater than

    • less than

    • greater than equals

    • less than equals

  • If you select a Number field, the operators available will be as follows:

    • equals

    • not equals

    • greater than

    • less than

    • greater than equals

    • less than equals

  • If you select any other field, the operators available will be as follows:

    • e quals

    • not equals

    • like

    • in


πŸ’‘ Tip

All the operators may not work for every field type. Use the preview option to verify that your query is working as expected.


Date Time Operator


πŸ“ Note

This field is available only when the field is of type Date Time and the operator selected is older than.


The available values are as follows:

  • LAST_N_DAYS

  • LAST_N_WEEKS

  • LAST_N_MONTHS

  • LAST_N_QUARTERS

  • LAST_N_YEARS

  • LAST_N_FISCAL_QUARTERS

  • LAST_N_FISCAL_YEARS

Relative Value


πŸ“ Note

This field is available only when the field is of type Date Time and the operator selected is older than.


Specify the value for the Date Time operator.

For example, to create a where clause which selects records older than five years, choose LAST_N_YEARS as the Date Time Operator and 5 as the Relative Value.

Date


πŸ“ Note

This field is available only when the field is of type Date Time and the operator selected is less than.


Use the calendar icon to select the desired date.

Value


πŸ“ Note

This field is available for string and numerical fields.


Specify the value for the Date Time operator selector earlier.

Delete

You can remove the field and associated selection criteria from your query.

You will see a delete icon for each field.


πŸ’‘ Tip

As you update the field values, you can see a preview of the SOQL query. You can use this query as a quick reference guide to validate if the query will select your desired records.


Logical operators and groups

You can add more fields by specifying one of the two logical operators – AND & OR.

You can also create a group that will create a pair of brackets. After that, you can add individual fields.


❗ Important

The AND & OR operators have some caveats in SOQL query syntax. For details, see Considerations.


Examples of SOQL queries with steps

The following examples assume that you have selected the Account object.


❗ Important

If you are using the Advanced option, do not begin the query with SELECT ... FROM Account WHERE. This will be added by the application. Similarly, do not use the Limit option. The query builder is only for building the where clause. This is applicable for both the Basic and Advanced options.


The query for the Advanced option

Steps to Follow for the Basic option

CreatedDate < LAST_N_YEARS:2 AND BillingState = 'TX'

  1. Field Name: CreatedDate.

  2. Operator: older than

  3. Date Time Operator: LAST_N_YEARS:2

  4. Relative Value: 2

  5. Add Condition with operator: AND

  6. Field Name: BillingState

  7. Operator: equals

  8. Value: β€˜TX’

BillingState = 'TX' OR BillingState = 'SC'

  1. Field Name: BillingState

  2. Operator: equals

  3. Add Condition with operator: OR

  4. Field Name: BillingState

  5. Operator: equals

  6. Value: β€˜SC’

CreatedDate < LAST_N_YEARS:2 AND ( BillingState = 'TX' OR BillingState = 'SC')

  1. Field Name: CreatedDate.

  2. Operator: older than

  3. Date Time Operator: LAST_N_YEARS

  4. Relative Value: 2

  5. Add Group with operator: AND

  6. Field Name: BillingState

  7. Operator: equals

  8. Add Condition with operator: OR

  9. Field Name: BillingState

  10. Operator: equals

  11. Value: β€˜SC’


πŸ“ Note

When you delete an object from the query builder, you are only changing the query you are building. This action does not change any previously archived data.


Preview records

After specifying the fields using the Query Builder or SOQL Editor, you can preview the query result by clicking Preview & Verify Content.

Configure_archival_preview.jpg

❗ Important

Ensure the written query is correct by clicking Preview & Verify Content. For more information, see Considerations.


The following fields are available on this screen:

Option

Description

Summary

The first section shows the object name, SOQL query, and the total number of records selected

Preview Table

This table shows the records selected by the SOQL query.


πŸ“ Note

A maximum of 500 records will be displayed in the preview. However, all the records selected will be selected for archival.


Where Clause

Use the where clause to view a subset of the selected records.


πŸ“ Note

Where clause on this screen is only to filter the data being previewed. Any change here will not impact the SOQL query that will retrieve the records for archival.


Column Selection

You can customize the columns being displayed in the preview.

Advanced configuration

You can specify the following configuration in this section:

Option

Description

Exclude Fields

By default, all the fields are archived.

If you wish to exclude certain fields from archival, select all those fields one by one.


πŸ’‘ Tip

If you specify certain fields to be excluded from archival, the values in those fields will not be available in the archived data. The record will be deleted from Salesforce after the archival. As a result, this value will not be available anywhere.


Index Fields

Salesforce Data Archiver will index the following fields by default:

  • Id

  • CreatedBy

  • CreatedDate

  • LastModifiedDate

You can add up to four more fields for indexing.

Child Objects to be Archived

By default, the application will archive all the mandatory child objects.

These objects will be preselected and highlighted.

If you wish to archive any other child objects, you can select all those objects one by one.


πŸ’‘ Tip

  1. Removing mandatory child objects from the archival will not backup the child object. However, those child object records will still get deleted when the application the master record is deleted

  2. If the child object is not selected to be archived, then while restoring the master object, it will not update any related records on the child object to link it back to the master object.

  3. For caveats, see Considerations.


Step 4: Notifications

Use the Notifications tab to configure who will be notified and when.

You can select the users who will receive the notifications in the following events:

  • Successful Archival

  • Failed Archival

  • Successful Archival Restore

  • Failed Archival Restore


❗ Important

You must select either SMS or Email for every user. Otherwise, the notifications will not be sent.


Step 5: Validations

Validations in Salesforce evaluate the data to meet defined field guidelines before saving the record. Disabling validations can be helpful if records are failing to be deleted from Salesforce during Archival processing.

Perform the following steps to disable validations.

  1. Select the checkbox Disable validation during Archival

  2. Select a Validation Type from the dropdown list. A metadata list appears for the selected validation type.

  3. Select the items from the list.

  4. Repeat steps 2 and 3 for all the desired validation types.

For more details, see Validations.

Step 6: Save Archival Set

Saving the archival set will schedule the archival jobs.

You can review the archived data and see the status of the archival jobs at any time you wish. For more information, see Managing Archival Set.

The next archival job will run at the scheduled tab selected in the Scheduling tab.

Considerations

Validate SOQL Queries

A SOQL query cannot have an AND operator along with an OR operator unless these are grouped using parentheses. For example, the following query is not a valid SOQL query:

SELECT .. FROM Account WHERE type='Customer' AND BillingState='NY' OR ShippingState='NY'

You can create a valid query that uses both OR and AND operator by using parentheses:

SELECT .. FROM Account WHERE type='Customer' AND (BillingState='NY' OR ShippingState='NY')

The query builder will not stop you from creating an invalid query such as this one. Ensure that the queries you are building are valid SOQL queries. Salesforce Data Archiver can help validate the query using Preview and Verity Content option on the query builder page.


πŸ’‘ Tip

If you are unable to build the required query, type in the where clause of the query in the advanced query option.


Archival of ContentDocument Object

When you select an object for archival, such as Account, the child objects are also archived. All you need to do is ensure that the child objects are selected in the Advanced Configuration section of the query builder.

The ContentDocument object is an exception and must be selected for archival separately.


πŸ’‘ Tip

One archival set can contain queries for multiple objects. For example, you can select both Account and ContentDocument objects, on the Archival Content tab of the New Archival Set.


Next Steps

Did this answer your question?