You are here:
Add the Archive Component to Page Layouts in Salesforce Classic
Add Archive components to Salesforce Classic page layouts so users can view archived related records directly from primary records.
You can configure either a single-object component that shows one child object, or a multi-object component that shows records across multiple related objects.
Turn on Lightning Out in your org. This feature is required to embed Lightning components in Visualforce pages.
Assign the Archive Admin permission set to the appropriate users.
Required User Permissions
| Task | User Permissions Needed |
|---|---|
| Create and edit Visualforce pages | Customize Application |
| Edit page layouts | Customize Application |
-
Create a Visualforce page for the Archive component.
Before you add the component to a layout, create a Visualforce page that serves as the container for the Lightning component.
- From Setup, in the Quick Find box, enter Visualforce Pages, and then select Visualforce Pages.
- Click New.
-
Enter a label and name (for example,
Account_Archive_Single). - Select Available for Salesforce mobile apps and Lightning Experience.
-
In the Visualforce markup tab, replace the existing code with the snippet for your use case.
Option A: Single-object component
Use this snippet to show archived records for one object. Replace Account with your primary object and Case with the archived entity to display.
<apex:page standardController="Account" showHeader="false" sidebar="false"> <apex:includeLightning/> <div id="archiveWidget" style="min-height:400px;"></div> <script> $Lightning.use( "runtime_platform_trustedservicesarchive:archivedWidgetsForClassic", function() { $Lightning.createComponent( "runtime_platform_trustedservicesarchive:singleRelatedRecordsArchivedWidgetForClassic", { recordId: "{!Account.Id}", objectApiName: "Account", archivedEntityName: "Case" }, "archiveWidget" ); } ); </script> </apex:page>Option B: Multi-object (list) component
Use this snippet to show archived records for up to 10 objects. Update the archivedEntitiesNames array with the object API names.
<apex:page standardController="Account" showHeader="false" sidebar="false"> <apex:includeLightning/> <div id="archiveListWidget" style="min-height:600px;"></div> <script> $Lightning.use( "runtime_platform_trustedservicesarchive:archivedWidgetsForClassic", function() { $Lightning.createComponent( "runtime_platform_trustedservicesarchive:listRelatedRecordsArchivedWidgetForClassic", { recordId: "{!Account.Id}", objectApiName: "Account", archivedEntitiesNames: ["Contact", "Opportunity", "Case"], maxArchivedEntitiesNames: 10 }, "archiveListWidget" ); } ); </script> </apex:page>Option C: EmailMessage Archive component
Use this snippet to view archived attachments or data for a specific email.
<apex:page standardController="EmailMessage" showHeader="false" sidebar="false"> <apex:includeLightning /> <div id="archiveWidget" style="min-height:400px;"></div> <script> $Lightning.use( "runtime_platform_trustedservicesarchive:archivedWidgetsForClassic", function() { $Lightning.createComponent( "runtime_platform_trustedservicesarchive:singleRelatedRecordsArchivedWidgetForClassic", { recordId: "{!EmailMessage.Id}", objectApiName: "EmailMessage", archivedEntityName: "ContentDocument" }, "archiveWidget" ); } ); </script> </apex:page> - Save your changes.
-
Add the Visualforce page to a page layout.
After you create the page, add it to the relevant object page layout.
- From Setup, go to the object you want to update (for example, Account or Email Message).
- Open Page Layouts, and select the layout you want to edit.
- In the palette, select Visualforce Pages.
- Drag your Visualforce page into a section on the layout.
-
Click the wrench icon (Properties) for the Visualforce page, and configure these settings.
- Width (Pixels or %):
100% - Height (Pixels): at least
400(or600for the list component) - Show scrollbars: selected
- Width (Pixels or %):
- Click OK, and then save your changes.

