Create an archive policy for objects that you want to archive.
Policies created or edited in the Archive Console are viewable but not actionable from the package. To drill down, edit a policy, or run a policy, refer to the Archive Console.
From Archive Package 21, a new Policies tab is displayed in the top navigation bar.
Lightning users see the new Policies tab.
Salesforce Classic customers must manually add the new Policies tab.
Configuring a policy is executed with the permissions of the dedicated authenticated user specified in the Archive account settings. The ability to create policies and preview results varies depending on the permissions you have.
To add the new tab:
- Open the Salesforce App Launcher.
- Under Items, select Policies.
-
Go to the Policies tab and select New.
The New Policy window opens.
- Select Archiving Policy.
-
Click Next.
The window opens on the Details tab of New Archiving Policy form.
You can click the Preview Table tab at any stage to view a sample of 10 detected records that match your query criteria.
-
In the Policy Information section, complete these fields.
- Policy Name: Enter an identifiable name. For example, Inactive Cases Opened 2 Years Ago. This field is mandatory.
- Description: Include a policy description. This field is optional.
- Enabled/Disabled: Only a policy set to
Enabledcan be run from the Archive Console. The default value isEnabled. - Schedule Policy (UTC): Schedule the frequency of the policy to run
daily, weekly, or monthly. This field is mandatory.
- For Day, select the hour from the dropdown list.
- For Week, select the day of the week (Sunday–Saturday) and then the hour.
- For Month, select the day of the month and the hour. You can also select the policy to run on the last day of the month.
- In the Query Details section, you can run a query based on a list of objects in your org, and filter which records to archive. For more details, see Archive Policies Query Details.
-
Click Save.
A success message is displayed.
- Archive Policies Query Details
Options to select for your archive policy queries in the Archive managed package. - Archive Related ContentDocuments
Depending on your requirements, ContentDocuments can be archived using one of these methods in the Archive managed package. Consider how each method aligns with your archiving strategy and data relationships before proceeding. - Archive ActivityFieldHistory
ActivityFieldHistory tracks changes made to specific fields on Activity records, such as Tasks and Events. This feature shows what the Archive managed package record was modified, the time and date when it was modified, and who made the change. - Archive ContentDocuments by Using Parent Object Filtering Criteria
Archive ContentDocument records by using filtering criteria based on parent objects in the Archive managed package. 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. This approach identifies duplicate records. - Archive EmailMessages with Related Tasks
Archive all EmailMessages along with their associated Tasks in the Archive managed package. - Archive Digital Signatures in Field Service Lightning (FSL)
When applyingDigitalSignaturesin the Archive managed package, theServiceAppointment,WorkOrder, andWorkOrderLineItemuse cases require special attention. - 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 in the Archive managed package, you can manually add a specific clause to your archive query. - Archive nCino Objects
The Archive managed package can archive files related to specific Loans, Relationships, Collateral Management, and other parent records from Document Manager. The parent record remains in your org while all root records are archived. - Same Root and Child Filter
Automatically exclude parent records from a data set when they have children of the same object type in the Archive managed package. This filter addresses a specific limitation in Salesforce Object Query Language (SOQL) and enables more advanced filtering of hierarchical data. - Archive Objects with Missing Relationship Names
When archiving related records in Salesforce, the Archive managed package typically relies on defined relationship names to navigate parent-child relationships. These relationship names are used in subqueries to identify and retrieve child records associated with a parent. 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 filterContentLocationby any external content references.
See Also
Archive Policies Query Details
Options to select for your archive policy queries in the Archive managed package.
Archive sObject
A list of available objects that can be deleted from your org. The selected object and all its related objects are archived.
Archiveable Root-Level Objects
In order for an object to be archived as a root-level object, these calls must be supported.
create()delete()describeSObjects()query()update()
- Any object in your Salesforce environment that doesn't support all of these calls isn't available in the Archive sObject list when creating an Archive Policy.
- Big Objects aren't supported.
Archive Records Filter
Select Filter in the Query dropdown list.
- Limit Query Field: The limit of records.
The allotted amount in a single archive policy is restricted to 2 million root records.
NoteUsers who need to archive more than 2 million root records per day are recommended to set multiple archive policies at complimentary time intervals with the same SOQL.
The final number of total records archived can be higher than 2 million, depending on the number of child records archived together under the root.
When setting multiple policies with the same SOQL, or policies with the same date range, make sure to schedule them to run at different times to avoid collisions.
Boosting must be used to enable up to 2 million records. For more information, see Boost under Advanced Settings.
- Take Action When
- All conditions are met: All the conditions in the condition builder
exist (similar to
ANDbetween conditions). - Any condition is met: Select this option when at least one of the
conditions in the condition builder exist (similar to
ORbetween conditions).
- All conditions are met: All the conditions in the condition builder
exist (similar to
- Field Object: Additional options are displayed once you select a date field type
object, such as CreatedDate or LastModifiedDate.
- Operator: An argument.
- Value: The number or text relevant for the query.
- Date Category: Scale in years, months, and days.
Click Add Conditions as needed.
- Reset Query: Clears all conditions built so far and allow you to start over.
- Delete: Deletes the reference condition.
- SOQL Query: Customizes the SOQL query. To create your own complex query, select
Manual from the Query dropdown list. Note You can use a handy query to archive records according to criteria in the parent object (Master-Detail). For example, archive all tasks where the parent cases are
status=closed.SELECT Id FROM Task WHERE WhatId IN (SELECT Id FROM Case WHERE status='On Hold') LIMIT 10This query can be applied to all objects.
Lookup Relationships
When you select an sObject, you can archive child objects under the selected object by checking the Lookup relations archiving checkbox.
This option is only available if there is a relationship to lookup from child to parent. If not, an error message related to that object appears.
Content Documents
Check the box to archive ContentDocument records that are potentially linked to other records still in Salesforce.
To maintain the relationship of the content document to records still in Salesforce, do not check the include Content Documents checkbox. Instead, define the policy with the Content Document as the root object.
Retention Policy
Select the criteria from these sources.
- Archived Date
- Created Date
- Last Modified Date
Select the amount of time you want to retain the archived data. The maximum is 99 years and eleven months.
Advanced Settings
Boost: Accelerates archiving throughput by running parallel activities. You can have up to 8 active boosted policies.
Salesforce Data Protected For: The number of days to prevent archiving newly created records. By setting a data protection period, records updated in this timeframe aren't archived even if they are included in the policy query results.
Archive ActivityFieldHistory
ActivityFieldHistory tracks changes made to specific fields on Activity records, such as Tasks and Events. This feature shows what the Archive managed package 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
- Selective Activation: ActivityFieldHistory isn't on by default in all orgs. Support reviews your setup to establish compatibility and compliance before activation.
- Regulatory Compliance: Support configures tracking to meet data protection requirements, establishing secure integration with Archive.
Data Security
- Sensitive Data Handling: Salesforce uses strict security measures to protect detailed tracking information stored in ActivityFieldHistory.
- Controlled Access: Salesforce Support verifies that appropriate access controls exist so only authorized users can archive historical activity data.
Expected Timeline for Availability
After Salesforce Support turns on ActivityFieldHistory, it can take a few hours 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
Unarchive Not Supported: After archiving, ActivityFieldHistory records can't be unarchived.
Post-Archive: 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.
Turn On ActivityFieldHistory
Request Activation: Contact Salesforce Support to turn on ActivityFieldHistory for Archive.
Configuration and Testing: Contact Own to turn on the ActivityFieldHistory feature.
Archive Digital Signatures in Field Service Lightning (FSL)
When applying DigitalSignatures in the Archive managed package, the
ServiceAppointment, WorkOrder, and
WorkOrderLineItem use cases require special attention.
ServiceAppointments as an example,
but these steps apply to all the use cases mentioned previously.-
Under Service Appointment, a Service Report is created as a child with an
In Progressstatus. - When the service has been provided, and the customer signs the Service Report, a Digital Signature is added to the Service Appointment.
-
When the Service Report is complete, the Content Document of the finalized
report is generated, and the Digital Signature is deleted.
The Service Report now has
Completedstatus.Note Archiving the Service Appointment before the Service Report has aCompletedstatus 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 in the Archive managed package, you can manually add a specific clause to your archive query.
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 use Archive to delete them from Salesforce and Archive into AWS/Azure.
- 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 you haven't turned on the new policy configuration window to archive records that Salesforce has previously archived into Archive, you must add this clause to the query.
WHERE IsDeleted=False AND IsArchived=True Limit XXX
SELECT Id FROM Task WHERE Title=" LIMIT 10
must be manually changed to SELECT Id FROM Task WHERE Title = ' AND
IsDeleted=False AND IsArchived=True LIMIT 10.Archive nCino Objects
The Archive managed package can archive files related to specific Loans, Relationships, Collateral Management, and other parent records from Document Manager. The parent 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, etc. and its Document Store Infrastructure.
As part of the policy, the underlying Document Manager infrastructure is archived together with the content document such as driver's license, passport and other financial transactions. Multiple versions of these documents are also archived.
Create a Policy
This use case archives a Loan Placeholder with all Content Documents, Content Versions, and Document Store infrastructure.
In this scenario, these documents were uploaded under these Placeholders.
- Credit Memo
- Privacy Policy
- Term Sheet
- Generated Forms - 3 versions
- Select Archiving Policy.
-
Click Next.
The policy window opens.
-
In the Policy Information section, add values for these fields.
- Policy Name: Enter an identifiable name.
- Description: Opt to include a policy description
- Enabled: If enabled, the policy becomes active when saved.
- Schedule Policy (UTC): Schedule the frequency to run the policy
(Daily/ Weekly / Monthly).
If applicable, additional options are displayed.
- All dates and hours are in UTC, make sure to adjust the time according to your time zone.
- When selecting Day, you are prompted for the Hour.
- When selecting Week you are prompted for the day of the week (Sunday-Saturday) and then the Hour.
- When selecting Month you are prompted for the day of the month and then the Hour.
-
In the Query Details section, populate these fields as part of the
policy.
- Archive SObject:
LLC_LoanDocument - Field:
LLC_BI__Loan__c - Logic:
AND - Operator:
equals - Value:
Golf Augusta Pro Shops - Real Estate Only
NoteIn this section, confirm these details.
- Enter
LLC_BI__attachmentId__cin the Field element. - Make sure that the Operator selected isn't empty.
- Check the Include Content Documents
checkbox.
A warning message appears when clicking the Include Content Documents checkbox.
SOQL Query Example
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 - Archive SObject:
- Click Accept.
-
To select the fields that are available in your Archive Widget view, click
Preview Table.
You can select up to 15 fields.
In our sample use case, these fields have been selected.
- Click Save.
View the Archived Data
To customize the page:
-
Add the Lightning Web Component to the Loan Object Page.
In this example, we have created a Custom Tab named Archived Documents and placed it next to Documents.
- View the Archived Documents under Loan: Golf Augusta Pro Shops - Real Estate Only.
-
To view the actual Content Document, click
CurrentAttachmentId.
This action takes you to the Content Document. To see a preview version, click on the right-hand side of the Content Document. If the Placeholder has multiple versions, the latest version of the Content Document is displayed.
-
To view all versions of a Placeholder with Content Document, click
Viewunder the little arrow on the right of the Placeholder.This action takes you to the Loan Placeholder (LLC_LoanDocument) Detail tab.- From the Detail tab, go to the Related tab.
- Under Related, you can see the Document Manager underlying Infrastructure. The Document Stores (1) Related Lists has all versions of the Content Document.
-
Click the Document Store Name link, or click
Viewon the right to get to the Document Store Detail Page. -
From the Detail tab, go to the Related tab.
The Related list displays all three versions of the Content Documents and Content Document Links and the link to the Document Store Indices.
- To see a preview version, click the right-hand side of any of the Content Documents.
Same Root and Child Filter
Automatically exclude parent records from a data set when they have children of the same object type in the Archive managed package. This filter addresses a specific limitation in Salesforce Object Query Language (SOQL) and enables more advanced filtering of hierarchical data.
The feature is available from the Archive Settings and lets you effectively isolate standalone or "leaf" records in a hierarchy for processing. For example, if a Case record is the parent of another Case, this filter excludes the parent, leaving only the child records.
While SOQL makes it easy to filter records based on a relationships to a different objects, such as finding Accounts with no Contacts, it doesn't support direct queries to filter records based on relationships to the same object, such as finding Cases that aren't parents of other Cases.
Same Root and Child Filter bridges this SOQL gap. It programmatically analyzes your records to provide this capability, enabling a more advanced level of filtering on hierarchical data.
Key Attributes
- Action: Skips the parent (root) record, not the child.
- Scope: Applies only to self-referencing hierarchies, such as Case to Case.
- Purpose: Solves a native SOQL limitation for filtering self-referencing lookups.
Archive Objects with Missing Relationship Names
When archiving related records in Salesforce, the Archive managed package typically
relies on defined relationship names to navigate parent-child relationships. These
relationship names are used in subqueries to identify and retrieve child records associated
with a parent. 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 (parent) object
to its related FeedItem (child)
records.
SELECT Id, (SELECT Id FROM FeedItems) FROM Account
Some
objects, such as FeedItem, do not expose relationship names in the
metadata. This means that Archive can't use subqueries to retrieve related records,
which can hinder the archiving process for those object types.
To address this
issue, Archive provides the Enable Archiving of Objects with Missing
Relationship Names setting. When this setting is enabled, Archive
uses foreign key fields, such as ParentId, to retrieve related
records directly, without depending on relationship names.
If the setting
isn't enabled, the previous query fails because FeedItem lacks a
subquery relationship name to Account.
Filter External Content References
The FeedItem object includes the ContentLocation
field to identify where content is stored.
Valid values for ContentLocation are:
E—Content is stored externally.S—Content is stored within Salesforce.
To avoid archiving records that refer to externally stored content, add a filter to the Archive query.
SELECT Id FROM FeedItem WHERE ParentId IN (list of Account Ids) AND ContentLocation != 'E'
This filter ensures only FeedItem records with content stored in
Salesforce are archived. By enabling this setting and using the appropriate filters,
you can archive records even when relationship names aren't available.