---
schema_version: "1"
id: eedaec1262a9f574fc7d6618284904147b01ccdaf28fac1f24c0d45ab957bf8f
title: Create Archive Policies
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/archive_create_policies.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: e7aae8b9113949ed84c7306da6a251ffff664ea01927f67dd186914e196cd700
description: To select specific records for archiving, define filters, schedule a process, and set data retention periods, create a policy in the Archive app.
products:
  - Salesforce Platform
  - Cross Cloud
release: "264"
---
# Create Archive Policies

To select specific records for archiving, define filters, schedule a process, and set data retention periods, create a policy in the Archive app.

Use the Archive policy wizard to define what objects to archive and when.

1. Go to the Policies tab and select **New**.
    
    The New Policy window opens by default on the Archive Salesforce Data tab.
2. Click **Next**.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
    
    Note Complete all mandatory fields marked with an asterisk before proceeding to the next step.
3. In the Policy Details section, complete these fields.
    
    - Policy Name: Descriptive name for the policy, such as Inactive Cases Older Than 2 Years.
    - Description: Detailed description of the policy's function.
    - Enabled: Runs the policy when saved. An active policy runs on its defined schedule.
4. Click **Next**.
5. Define the policy scope and query logic.
    
    - Root Object to Archive: The selection of the root object to archive determines the hierarchy of related objects available later.
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
        
        Note To be available as a root object, the object supports `create()`, `delete()`, `describesObjects()`, `query()`, and `update()` API calls. Big Objects aren't supported.
    - Query Mode: Specifies which root records to archive. These options are available.
        - Filter: Build query conditions by using the standard condition builder. Use the Field, Operator, and Value lists. Click **+Add Condition** to add criteria.
        - Manual: Write a custom Salesforce Object Query Language query in the editor. Use this mode for complex queries that the standard condition builder doesn't support.
    - Record Limit: Maximum number of root records that this policy can archive in a single run. The limit is 2,000,000 records.
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
        
        Note The total number of archived records, including children, can exceed this limit. To archive more than 2,000,000 root records daily, create multiple policies with the same SOQL criteria and schedule them to run at different times.
    - Archive Related Files and Attachments: Archives all files and attachments associated with the root record.
        
        ![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_important.png)
        
        Important Archiving a file breaks any links that it has with other active records. Archive safely stores the file. The file remains accessible from the archived record's component, but the file is no longer visible on the active records.
    - Data Protected For: Total number of days to prevent newly created or updated records from being archived. The default is 90 days.
6. Optionally, click **Show Preview** to view a sample of 10 records that match your scope.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
    
    Note Records excluded by the Data Protected For setting don't appear in the preview.
7. Click **Next**.
8. Select the Root Object Archive Hierarchy. These options are available.
    
    - Custom Selection: Expands the hierarchy and includes specific related objects.
        - Auto-Archived Object: Objects with a master-detail or restricted lookup relationship are included automatically and can't be deselected.
        - Available Object: Includes the available object in the archive.
            
            ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
            
            Note If you don't see a standard or custom object in the Available Objects panel, check with your admin to make sure that you have the correct user permissions. Standard objects appear under your org's language object label name, so searching by the English name (such as Account) can return no results. Search by the localized label, or change your language in your personal settings.
        - Locked Relationship: Indicates a non-editable master-detail or restricted lookup.
            
            ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
            
            Note Selecting a lookup object archives only that object, not its children, unless you explicitly select them. If you deselect a root object, its child objects are deselected automatically to prevent orphaned records.
    - Complete Hierarchy: Archives the root object and all descendant objects.
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
        
        Note This option removes the root object and all descendant records from active storage. Make sure that you intend to remove the entire data hierarchy from your live environment.
9. Click **Next**.
10. Configure Schedule, Retention, and Advanced Settings.
    
    - Policy Schedule (UTC): Sets the frequency, day, and time.
    - Retention Period: Defines the minimum time to retain archived data. The maximum time is 99 years and 11 months.
        
        ![Warning](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_warning.png)
        
        Warning Set retention to zero years and zero months only if you intend to automatically purge all archived data within 24 hours. This action cannot be undone.
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
        
        Note Editing the retention period on an existing policy affects all records previously archived by that policy. To apply a new retention period only to future archived records, create a policy.
    - These advanced settings are optional.
        - Enable Boosting: Runs up to eight parallel activities per policy.
        - Log Failures and Continue: If errors occur, logs individual deletion failures instead of rolling back the entire transaction. Select this option if your archive jobs involve root records with more than 800 related objects. For more information, see [Log Failures and Continue](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5 "During the archive process, the Archive app uses a single transaction to delete a root record with 800 or fewer related child records as an \"all-or-nothing\" operation. If an archive job fails to delete a single related child record due to a validation rule, the entire transaction rolls back. The Log Failures and Continue setting processes root records with more than 800 related child records. This setting breaks deletion into batches, logs individual record failures, and processes the rest of the archive job without rolling back the entire transaction.").
11. Save your work.
    
    If you turn on the Enabled option, the policy runs at the next scheduled time.

- **[Related Object Selection](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Your Salesforce data forms a complex hierarchy. Accounts have Contacts, Contacts have Tasks, and Tasks have their own related records. To archive root records and their relationships up to 25 levels deep, use Related Object Selection in the Archive app.
- **[Log Failures and Continue](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    During the archive process, the Archive app uses a single transaction to delete a root record with 800 or fewer related child records as an "all-or-nothing" operation. If an archive job fails to delete a single related child record due to a validation rule, the entire transaction rolls back. The Log Failures and Continue setting processes root records with more than 800 related child records. This setting breaks deletion into batches, logs individual record failures, and processes the rest of the archive job without rolling back the entire transaction.
- **[SOQL Manual Query Mode](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Use SOQL to define complex criteria for your archive policies when using Manual Query mode in the Archive app.
- **[Archive ContentDocuments](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    ContentDocuments are files that can be archived as a root object or with a root record in the Archive app. Consider how each method aligns with your archiving strategy and data relationships before proceeding.
- **[Archive ActivityFieldHistory](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Track changes made to specific fields on Activity records, such as Tasks and Events. The ActivityFieldHistory feature shows what Archive app record was modified, the time and date when it was modified, and who made the change.
- **[Apply Parent Object Filters to Archive ContentDocuments](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Archive ContentDocument records in the Archive app by using filtering criteria based on parent objects.
- **[Configure Lookup Fields and Archiving Criteria](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Create lookup fields and apply archiving criteria to your Archive app ContentDocuments.
- **[Archive EmailMessages with Related Tasks](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Archive all EmailMessages and their associated Tasks in the Archive app with the Archive EmailMessages with Related Tasks setting, or by archiving the Task as a root record.
- **[Archive Digital Signatures in Field Service Lightning](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    When applying Digital Signatures in the Archive app, the Service Appointment, Work Order, and Work Order Line Item use cases require special attention.
- **[Archive Archived Records in Salesforce](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Archive records previously archived in your org, including events and closed tasks over 365 days old. If the new policy configuration window isn't turned on, you can manually add a specific clause to your query in the Archive app.
- **[Archive nCino Objects](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    The Archive app can archive files related to specific Loans, Relationships, Collateral Management, and other root records from Document Manager. The root record remains in your org while all root records are archived.
- **[Same Root and Child Filter](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    Automatically exclude root records from a dataset when they have children of the same object type. This filter addresses a specific limitation in Salesforce Object Query Language (SOQL) and enables more advanced filtering of hierarchical data in the Archive app.
- **[Enable Archiving of Objects with Missing Relationship Names](https://help.salesforce.com/s/articleView?id=xcloud.archive_create_policies.htm&release=264.0.0&type=5)**  
    When archiving related records, the Archive app typically relies on defined relationship names to navigate root-child relationships. These relationship names are used in subqueries to identify and retrieve child records associated with a root record. However, some objects don't expose relationship names in the metadata, which can limit or block the archiving process for those object types. To archive these objects, use the Enable Archiving of Objects with Missing Relationship Names setting and then filter `ContentLocation` by any external content references.

## Related Object Selection

Your Salesforce data forms a complex hierarchy. Accounts have Contacts, Contacts have Tasks, and Tasks have their own related records. To archive root records and their relationships up to 25 levels deep, use Related Object Selection in the Archive app.

When you set up an archive policy, you can handle related records by selecting Complete Hierarchy or Custom Selection.

### Archive the Complete Hierarchy

Complete Hierarchy archives the root record and all its related child records. For example, if you select an Account, the policy archives the Account and all its descendant records, such as Contacts, Opportunities, Cases, and Tasks.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)

Note Use this option only after validating that you want all records under the root object archived. Make sure that there are no dependencies that cause issues if you remove the entire hierarchy from your org.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)

Note Selecting Complete Hierarchy doesn't show the hierarchy tree preview.

### Archive a Custom Selection

Custom Selection archives only the records you manually select. For example, you can archive Accounts and Contacts but keep Tasks and Cases in Salesforce.

When you create or edit an archive policy, the hierarchy tree shows all master-detail and lookup relationships for the object.

### Hierarchy Tree Icons

 
| Icon | Description |
| --- | --- |
| ![Gray checkmark icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/setup/images/gray_checkmark_icon.png) | Objects with a master-detail or restricted lookup relationship to the root. These objects are automatically included and can't be deselected. |
| ![Empty checkbox icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/setup/images/empty_checkbox_icon.png) | You can select this checkbox to include the object in the archive. |
| ![White checkmark icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/setup/images/white_checkmark_icon.png) | Selected object. To view its child objects, click the expand arrow icon. |
| ![Expand arrow icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/setup/images/expand_arrow_icon.png) | Indicates that child objects are available for selection. |
| ![Locked icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/setup/images/locked_icon_icon.png) | Indicates a non-editable master-detail or restricted lookup. You can still select lookup objects under it. |
| ![Recurring icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/setup/images/recurring_icon.png) | This object type recurs in the hierarchy. |

To identify only restricted lookups, select Hide Master Details.

To select records:

1. In the Create Archive Policy wizard, select the root object.
2. On the Select Archive Hierarchy page, click **Custom Selection**.
3. Select the checkbox next to the related lookup object that you want to archive.
4. Click the arrow icon to expand the hierarchy tree and view related records.
5. Select specific child objects up to 25 levels deep.
6. To confirm your archive policy, click **Next**.

### Important Considerations for Custom Selection

- Selecting an object record doesn’t automatically include its child objects. For example, if you select a Contact record, expand the Contact record hierarchy and manually select the related child Task records that you want to archive.
- If you select a child object but later unselect its root, the child object is deselected automatically from the archive.
- You can't unselect master-detail or restricted lookup objects, but you can select their child objects.
- If you modify your object schema, such as adding new fields or relationships, it can take up to 48 hours for changes to appear in Archive Policy Builder.
- When you select an object anywhere in the hierarchy tree, it’s marked as selected everywhere it appears.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
    
    Note To prevent infinite loops, if an object is a recurrence of one of its ancestors, the object becomes a leaf node. If you try to access any child objects that stem from this leaf node, this message appears: "This object has already been selected and can't be drilled down from here. This object type is a recurrence of its ancestor."
- Check your Archive Settings for global overrides. Make sure that options such as Exclude Feed Objects, Exclude History Objects, or Exclude Share Objects don’t omit master-detail objects you intend to archive.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
    
    Note For a full list of objects that are globally ignored and skipped automatically, see [Salesforce Objects Excluded from Archive](https://help.salesforce.com/s/articleView?id=xcloud.archive_objects_excluded_from_archive.htm&type=5&language=en_US).

### Search Archived Hierarchies

You can search for any archived root or child record from Archive Search or the Archive component. To view all the related records archived with a root object from the Archive component, go to the Related tab. To go to the next hierarchical level, and so on, click the expand arrow icon of an object.

### Unarchive Related Records

Unarchive related records through the root object. When you restore the root object, you restore all its archived related records with their relationships intact.

### Archive Hierarchy Selection Limitations

- Except for ContentDocuments, Archive only supports junction objects on one side of the relationship.
- Except for ContentDocuments, lookup children that point to a different root object not shown in the current hierarchy, also known as side branches, aren't shown or selectable.

## Log Failures and Continue

During the archive process, the Archive app uses a single transaction to delete a root record with 800 or fewer related child records as an "all-or-nothing" operation. If an archive job fails to delete a single related child record due to a validation rule, the entire transaction rolls back. The Log Failures and Continue setting processes root records with more than 800 related child records. This setting breaks deletion into batches, logs individual record failures, and processes the rest of the archive job without rolling back the entire transaction.

To activate this setting, go to Schedule, Retention, and Advanced Settings in the Archive policy wizard. In the Advanced section, check Log Failures and Continue.

### Single Transaction Mode vs. Batch Mode

The Archive app handles deletions differently based on the volume of related child records.

Root records with 800 or fewer related child records attached to a specific root record use Single Transaction mode. A single "all-or-nothing" API request deletes the root record and its related child records. If one record fails, the whole transaction rolls back. The Log Failures and Continue setting doesn't apply.

Root records with more than 800 related child records use Batch mode. The root records and its related child records are split into smaller batches before deletion. If a related child record in the first batch fails, the entire transaction is canceled. In subsequent batches, if a related child record fails, Archive logs it, skips it, and continues the process. This action creates a live duplicate in your org.

### Data Integrity and Trade-Offs

While this setting prioritizes archive job completion, it creates the risk of a successfully archived record remaining live. The system then identifies the live duplicate record and automatically excludes it from future archive jobs. Log Failures and Continue also provides a Download Duplicate Records CSV report of all archive records from Reports on the Archive home page. Review these reports to identify these types of duplicates.

- Lookup Child Record Duplicates: One or more related records, such as a Task, are archived but aren't deleted from your org.
- Root Record Duplicates: The root record, such as Case, and some of its related records are archived but aren't deleted from your org.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_example.png)

Example You have a policy to archive a Case root record that has 1,200 related Activity child records.

If you don't turn on the Log Failures and Continue setting, the archive job stops because the related Activity child record count exceeds 800. Archive doesn't archive the Case root record, and it doesn't delete any records.

If you turn on the Log Failures and Continue setting, and one related Activity child record isn't archived because of a custom validation rule, Archive logs the single failure and skips deleting that related Activity child record. The archive process deletes the remaining related Activity child records that don't conflict with custom validation rules. Archive successfully archives the Case root record. Any remaining related Activity child records that Archive doesn't delete remain live duplicate records. The system logs these records in the Duplicate Lookup Record report.

## SOQL Manual Query Mode

Use SOQL to define complex criteria for your archive policies when using Manual Query mode in the Archive app.

### Archiving Based on Related Objects

In Manual Query mode, you can archive records based on criteria found in a related object. This mode is useful when the criteria for archiving aren't on the root object itself, but on a root record.

### Example: Archive Tasks Related to Closed Cases

This SQL example demonstrates how to archive Task records that are associated with closed Case records. This query selects Task IDs where the `WhatId` matches the ID of a Case with a `Closed` status.

```
SELECT Id FROM Task WHERE WhatId IN (SELECT Id FROM Case WHERE Status='Closed')
```

### Important Considerations

- Make sure that your query always selects the `Id` field of the root object.
- Complex queries that use sub-selects aren't supported in the standard Condition Builder. Enter these queries manually in the SOQL Query editor.

## Archive ContentDocuments

ContentDocuments are files that can be archived as a root object or with a root record in the Archive app. Consider how each method aligns with your archiving strategy and data relationships before proceeding.

### Archive ContentDocument as a Root Object

Select this method when a ContentDocument is a standalone entity or linked to multiple root records. For example, if a legal template is linked to many different Cases, you can preserve the ContentDocument's relationships with all these linked root records by archiving it as a root object.

ContentDocuments can be archived on their own schedule, regardless of the status of its linked records.

Important Considerations

- ContentDocument Links (CDLs), which connect ContentDocuments to root records, are archived along with the ContentDocuments.
- As CDLs remain preserved, archived ContentDocuments can still be found via Archive Search.
- You can specify which ContentDocuments to archive. For example, you can create a policy to archive all ContentDocuments related to the Case object that haven't been modified in 5 years.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_example.png)

Example A ContentDocument named Project Plan Q1 is linked to Case-101 and Opportunity-ABC.

You create a policy to archive Project Plan Q1 as a root object.

Project Plan Q1 is archived. The archived record shows that Project Plan Q1 was historically linked to both Case-101 and Opportunity-ABC. However, Project Plan Q1 no longer appears in the Files list on Case-101 and Opportunity-ABC, which are still live in your org. The relationship history of the ContentDocument is intact within the archive.

### Archive Root Records with Related ContentDocuments

Select this method when a ContentDocument is directly related to a single root record that you want to archive. When the root record is archived, all its related ContentDocuments are bundled and archived with it in a single operation. For example, when you archive an old Account, you also want to archive all the ContentDocuments, such as contracts, invoices, and meeting notes attached to it.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_example.png)

Example An Account named ABC Corp has a related Case with a Service Agreement file attached.

You create a policy to archive ABC Corp Account and select the Archive Related ContentDocuments option.

ABC Corp Account is archived. The Archive policy automatically finds and archives the related Service Agreement file from the Case. The ContentDocument and the Account remain linked in the archive.

### Exclude ContentDocuments with Non-Archived Parents

When you want to archive a root record and all its related ContentDocuments but a related ContentDocument is linked to other root records in your org, this setting prevents you from archiving the ContentDocument.

When you turn on this setting, the system runs a safety check before archiving a ContentDocument. If a ContentDocument is related to any active root record in your org, it doesn't get archived with the root record being processed.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_example.png)

Example A file named Sales Presentation is linked to two records: Opportunity A with a Status of `Closed Lost` and Opportunity B with a Status of `Active`. Opportunity A is ready to be archived. Opportunity B remains active.

You run an archive policy to archive Opportunity A.

The system inspects Sales Presentation and sees that it's also linked to Opportunity B, which isn't being archived. Because one of its related root records is active, the Archive policy skips the ContentDocument. Sales Presentation remains live in Salesforce and is correctly linked to Opportunity B, preventing data loss.

Opportunity A is archived without the ContentDocument. When Opportunity B is archived, it automatically archives the ContentDocument.

## Archive ActivityFieldHistory

Track changes made to specific fields on Activity records, such as Tasks and Events. The ActivityFieldHistory feature shows what Archive app record was modified, the time and date when it was modified, and who made the change.

### Why Salesforce Support Is Required

Controlled Access and Availability

- ActivityFieldHistory isn't on by default in all orgs. Support reviews your setup to establish compatibility and compliance before activation.
- Support configures tracking to meet data protection requirements, establishing secure integration with Archive.

Data Security

- Salesforce uses strict security measures to protect detailed tracking information stored in ActivityFieldHistory.
- Salesforce Support verifies that appropriate access controls exist so that only authorized users can archive historical activity data.

### Enable ActivityFieldHistory

To enable ActivityFieldHistory for Archive, contact Salesforce Support.

After ActivityFieldHistory is enabled, it can take up to a few days for the object to be available for archiving. Availability depends on how much data is in the object and how long it takes for the system to process it.

Limitations:

- After archiving, ActivityFieldHistory records can't be unarchived.
- After archiving, the ActivityFieldHistory object can briefly appear in both Archive and Salesforce. This status is temporary. The record has been deleted in Salesforce, and the system completes the deletion asynchronously. This delay is normal and establishes data consistency across systems.

## Apply Parent Object Filters to Archive ContentDocuments

Archive ContentDocument records in the Archive app by using filtering criteria based on parent objects.

For example, you can archive files associated with Opportunities when the opportunity stage is `Closed Lost`. You can use this business case to archive specific files while retaining essential Opportunity records in the system. Filtering by parent objects also identifies duplicate records.

Before you archive, understand the distinction between ContentDocument and ContentVersion.

- ContentDocuments are created when a file is uploaded to Salesforce, reflecting the file's relationship to the parent object.
- ContentVersion represents the specific version of a document.

### Query ContentDocuments by Parent Record

To retrieve a list of ContentDocument records linked to an Opportunity, use this query.

```
SELECT Id, ContentDocumentId, LinkedEntityId FROM ContentDocumentLink
WHERE LinkedEntityId IN (SELECT Id FROM Opportunity)
```

You then extract ContentVersion record IDs for the related ContentDocument.

```
SELECT ContentDocumentId, Id FROM ContentVersion
```

### Make Files Visible to the Integration User

The archive job runs as the Archiver Integration User, which archives only the files it can see. Salesforce governs file visibility separately from record access. A file shared only through its link to a record, and not through a shared library, isn't always visible to the Integration User. If the Integration User can't see the file, the ContentVersion subquery returns no rows, and the file isn't archived.

To make hidden files visible so that they're archived, assign the Integration User the Query All Files permission. This permission grants access to all files during archiving. See [Authenticated User Permission Requirements for Archive](https://help.salesforce.com/s/articleView?id=xcloud.archive_authenticated_user_permission_requirements.htm&release=264.0.0&type=5 "Archive connects to your Salesforce org through the API via an Authenticated User. This user account serves as the integration point for all Archive operations."). Then make the files visible in one of these ways.

- Add the Integration User to the relevant library.
- Share the files through ContentDocumentLink.

## Configure Lookup Fields and Archiving Criteria

Create lookup fields and apply archiving criteria to your Archive app ContentDocuments.

1. Create a lookup field on the ContentVersion object that references the root object used for filtering. For example, the field name can be `ContentDocLookupOppty`.
2. Create a formula checkbox on the ContentVersion object that contains the archiving criteria.
    
    For example, the checkbox could be called `OpptyClosedLost` with this formula.
    
    ```
    ISPICKVAL(ContentDocLookupOppty__r.StageName ,'Closed Lost')
    ```
3. Use Salesforce Inspector, Workbench, or another third-party tool to update the lookup field with the correct related records. You can extract the related records with this query.
    
    ```
    SELECT Id, ContentDocumentId, LinkedEntityId FROM ContentDocumentLink 
    WHERE LinkedEntityId IN (SELECT Id FROM Opportunity)
    ```
    
    In this query, `LinkedEntityId` is the ID of the related root record.
4. Match the `ContentDocumentId` with the corresponding `LinkedEntityId` and update the lookup field. We recommend that you use a spreadsheet to help with this data update.
    
    - Copy and paste your ContentDocumentLink query results in the highlighted columns of the `ContentDocumentLink` tab.
    - Copy and paste your ContentVersion query results in the highlighted columns of the `ContentVersion` tab.
    - The `ContentVersion_For_Upsert` tab is your output data sheet for upserting.
        
        You can download this specific sheet as a CSV file and import the records to your org.
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
        
        Note Upsert field mapping require `Id` and `ContentDocLookupOppty` fields.
5. To make sure that the lookup field populates in the future, create a flow that forces the field to update continually.
6. To create the archive policy, select ContentDocuments as the object and configure the fields.

Here's an example query.

```
SELECT Id FROM ContentDocument WHERE Id IN (SELECT ContentDocumentId 
FROM ContentVersion WHERE Formula_checkbox_API_Name = TRUE)
```

## Archive EmailMessages with Related Tasks

Archive all EmailMessages and their associated Tasks in the Archive app with the Archive EmailMessages with Related Tasks setting, or by archiving the Task as a root record.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)

Note To archive and unarchive ContentDocuments such as EmailMessage records with attachments, turn on the Salesforce Enhanced Email and the Email Drafts settings in your org.

In Salesforce, sending an Email automatically creates a related Task with the same reference ID. When you archive an Email, depending on your org settings, its related Task can be deleted or remain in your org.

If you later unarchive the Email, a new related Task is created. If the original related Task wasn't deleted, the Email now has duplicate related Tasks. However, any custom fields from the original related Task aren't included in the new one.

To avoid duplicate related Tasks, turn on the Enable Archive EmailMessages with Related Tasks setting. When enabled, Archive automatically finds the related Task and archives it along with the Email.

1. Go to Archive Settings.
2. Under Archive, select **Archive EmailMessages with Related Tasks**.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)

Note When you unarchive an Email, the system inspects whether the original related Task still exists. If the original related Task was deleted, Archive generates a new one, and it's restored along with the Email.

### Archive Tasks as Root Records

To make sure that Emails and their attachments are archived together, configure the archive policy on the Task object. This configuration establishes a relationship between the EmailMessage and its related Task.

1. Define the archive policy on the Task object.
2. Add these values for Field, Operator, and Value.
    
    - Field: `Task Subtype`
    - Operator: `Equals`
    - Value: `Email`
3. Save your work.
    
    The related Task is archived automatically with its root Email.

## Archive Digital Signatures in Field Service Lightning

When applying Digital Signatures in the Archive app, the Service Appointment, Work Order, and Work Order Line Item use cases require special attention.

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)

Note This article uses Service Appointments as an example, but these steps apply to all the use cases mentioned previously.

1. Under Service Appointment, a Service Report is created as a child with an `In Progress` status.
2. When the service has been provided and the customer signs the Service Report, a Digital Signature is added to the Service Appointment.
3. When the Service Report is complete, the ContentDocument of the finalized report is generated and the Digital Signature is deleted.
    
    The Service Report now has a `Completed` status.
    
    ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)
    
    Note Archiving the Service Appointment before the Service Report has a `Completed` status isn't recommended because you can't finalize the process.
    
    If Service Appointments are archived before the document is finalized and then unarchived, Salesforce removes the Digital Signature file upon reinsertion for business logic reasons.

## Archive Archived Records in Salesforce

Archive records previously archived in your org, including events and closed tasks over 365 days old. If the new policy configuration window isn't turned on, you can manually add a specific clause to your query in the Archive app.

Salesforce archives these activities.

- Events that ended more than 365 days ago.
- Closed tasks due more than 365 days ago.
- If there's no due date, closed tasks created more than 365 days ago.

Salesforce doesn't delete archived activities, but they can be deleted manually, or you can use Archive to delete them from both your org and Archive into AWS or Azure.

Important Considerations

- When you create or refresh a sandbox, archived activities aren't copied.
- You can view and interact with archived activities in exported data and in certain locations in Salesforce.

If the New Policy Configuration window to archive previously archived records isn't turned on, manually add this clause to the query.

```
WHERE IsDeleted=False AND IsArchived=True Limit XXX
```

For example, here's a standard archive policy query.

```
SELECT Id FROM Task WHERE Title=" LIMIT 10
```

Now, manually add the query clause to the policy.

```
SELECT Id FROM Task WHERE Title =" AND IsDeleted=False AND IsArchived=True LIMIT 10
```

.

## Archive nCino Objects

The Archive app can archive files related to specific Loans, Relationships, Collateral Management, and other root records from Document Manager. The root record remains in your org while all root records are archived.

You can create policies on these main Placeholder objects to be archived as Roots with all of their attached documents.

- Loan Placeholder \[`LLC_LoanDocument`\] and its Document Store Infrastructure.
- Relationship Placeholder \[`LLC_BI__Account Document`\] and its Document Store Infrastructure.
- Global Placeholder \[`LLC_BI__ Document_Placeholder`\] used in Collateral Management, Deposits, and its Document Store Infrastructure.

As part of the policy, the underlying Document Manager infrastructure is archived together with the ContentDocument, such as driver's license, passport, and other financial transactions. Multiple versions of these documents are also archived.

### Create a Policy

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-setup-264-0-0-production-enus/6f21df35-9ea0-4f53-ac94-45c3b5dfd5bc/images/icon_note.png)

Note This use case archives a Loan Placeholder with all ContentDocuments, ContentVersions, and Document Store infrastructure.

These steps apply to all three Placeholder objects.

In this scenario, these documents were uploaded under these Placeholders.

- Credit Memo
- Privacy Policy
- Term Sheet
- Generated Forms - 3 versions

1. Go to the Policies tab arrow and select **+New Policy**.
2. Select **Archive Policy**.
3. Click **Next**.
4. In the Policy Information section, add values for these fields.
    
    <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
                  <colgroup>
                    <col style="width:50%">
                    <col style="width:50%">
                  </colgroup>
                  <thead class="slds-text-title_caps ">
                    <tr class="">
                      <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d30009e1636">Field</th>
                      <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d30009e1639">Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr class="">
                      <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1636 ">Policy Name</td>

                      <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1639 ">Enter an identifiable name.</td>

                    </tr>
                    <tr class="">
                      <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1636 ">Description</td>

                      <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1639 ">Opt to include a policy description.</td>

                    </tr>
                    <tr class="">
                      <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1636 ">Enabled</td>

                      <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1639 ">If enabled, the policy becomes active when
                        saved.</td>

                    </tr>
                    <tr class="">
                      <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1636 ">Schedule Policy (UTC)</td>

                      <td data-label="Description" class="slds-cell-wrap" style="vertical-align:top;" headers="d30009e1639 ">
                        <p>Schedule how often the policy runs: Daily,
                          Weekly, or Monthly. All times are in UTC. Adjust
                          the time according to your time zone.</p>
                        <ul>
                          <li>When selecting Day, you’re prompted for the Hour</li>

                          <li>When selecting Week, you’re prompted for the day of
                            the week (Sunday-Saturday) and the Hour.</li>

                          <li>When selecting Month, you’re prompted for the day of
                            the month and the Hour.</li>

                        </ul>
                      </td>

                    </tr>
                  </tbody>
                </table>
5. In the Query Details section, populate these fields as part of the policy.
    
    - Archive sObject: `LLC_LoanDocument`
    - Take Action When: `All conditions are met`
    - Field: `LLC_BI__Loan__c`
    - Operator: `equals`
    - Value: `Golf Augusta Pro Shops - Real Estate Only`
    - Logic: `AND`
6. After the `AND`, populate these fields in the second row.
    
    - Field: `LLC_BI__attachmentId__c`
    - Operator: `is not empty`
7. Add this code block to SOQL Query.
    
    ```
    SELECT Id FROM LLC_BI_LLCLoanDocument_c 
    WHERE LLC_BI_Loan_r.Name + 'Golf Augusta Pro Shops - Real Estate Only' 
    AND LLC_BI_AttachmentId_c!="LIMIT 10
    ```
8. Select **Include ContentDocuments**.
9. Click **Accept**.
10. To select the fields that are available in your component view, click **Preview Table**.
    
    You can select up to 15 fields.
11. Save your work.

### View the Archived Data

To customize the page:

1. Add the Lightning Web Component to the Loan Object Page.
    
    In this example, we create a custom tab named Archived Documents and placed it next to Documents.
2. View the Archived Documents under the loan named Golf Augusta Pro Shops—Real Estate Only.
3. To view the actual ContentDocument, click **CurrentAttachmentId**.
    
    This action takes you to the ContentDocument. To see a preview version, click the right-hand side of the ContentDocument. If the Placeholder has multiple versions, the latest version of the ContentDocument is shown.
4. To view all versions of a Placeholder with ContentDocument, click `View` under the little arrow on the right of the Placeholder.
    
    This action takes you to the Loan Placeholder (`LLC_LoanDocument`) Detail tab.
    
    1. From the Detail tab, go to the Related tab.
    2. Under Related, you can see the Document Manager underlying Infrastructure. The Document Stores (1) Related Lists has all versions of the ContentDocument.
    3. Click the Document Store Name link, or click `View` on the right to get to the Document Store Detail Page.
    4. From the Detail tab, go to the Related tab.
        
        The Related list shows all three versions of the ContentDocuments and ContentDocument Links and the link to the Document Store Indices.
    5. To see a preview version, click the right-hand side of any of the ContentDocuments.

## Same Root and Child Filter

Automatically exclude root records from a dataset when they have children of the same object type. This filter addresses a specific limitation in Salesforce Object Query Language (SOQL) and enables more advanced filtering of hierarchical data in the Archive app.

Same Root and Child Filter can be found in Archive Settings under the Archive tab. This feature effectively isolates standalone or "leaf" records in a hierarchy for processing. For example, if a Case record is the root record of another Case, this filter excludes the root record, leaving only the child records.

Although SOQL makes it easy to filter records based on relationships to different objects, such as finding Accounts with no Contacts, SOQL doesn't support direct queries to filter records based on relationships to the same object. For example, you can't use SOQL to find Cases that aren't root records of other Cases.

Same Root and Child Filter bridges this SOQL gap. This feature programmatically analyzes your records to provide this capability, enabling a more advanced level of filtering on hierarchical data.

## Enable Archiving of Objects with Missing Relationship Names

When archiving related records, the Archive app typically relies on defined relationship names to navigate root-child relationships. These relationship names are used in subqueries to identify and retrieve child records associated with a root record. However, some objects don't expose relationship names in the metadata, which can limit or block the archiving process for those object types. To archive these objects, use the Enable Archiving of Objects with Missing Relationship Names setting and then filter `ContentLocation` by any external content references.

For example, in this query `FeedItems` is the relationship name that connects the `Account` root object to its related `FeedItem` child record.

```
SELECT Id, (SELECT Id FROM FeedItems) FROM Account
WHERE Id IN ('account_id_1', 'account_id_2')
```

Some objects, such as `FeedItem`, don't expose relationship names in the metadata. Archive can't use subqueries to retrieve related records, which can hinder the archiving process for those object types.

When you turn on Enable Archiving of Objects with Missing Relationship Names, Archive uses foreign key fields, such as `ParentId`, to retrieve related records directly, without depending on relationship names. If the setting isn't turned on, the previous query fails because `FeedItem` lacks a subquery relationship name to `Account`.

### Filter by External Content References

You can filter records based on where their content is stored.

For example, a `FeedItem` object includes a `ContentLocation` field that identifies whether content is stored externally (`E`) or within Salesforce (`S`).

To avoid archiving records with externally stored content, you can add a filter to your query.

```
SELECT Id FROM FeedItem WHERE ParentId IN (list of Account Ids) AND ContentLocation != 'E'
```

When this filter is applied, only `FeedItem` records with content stored in Salesforce are archived.

#### See Also

- [Archive Search](https://help.salesforce.com/s/articleView?id=xcloud.archive_search.htm&release=264.0.0&type=5 "Search for and view the records you've archived. Archive Search respects only object-level permissions, not sharing rules or role hierarchy, so users with access can view all records for accessible objects. Limit access to admins.")