Loading
Prepare for Email to Become the Default Login ExperienceRead More
Set Up and Maintain Your Salesforce Organization
Add the Archive Component to Page Layouts in Salesforce Classic

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
  1. 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.

  2. From Setup, in the Quick Find box, enter Visualforce Pages, and then select Visualforce Pages.
  3. Click New.
  4. Enter a label and name (for example, Account_Archive_Single).
  5. Select Available for Salesforce mobile apps and Lightning Experience.
  6. 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>
  7. Save your changes.
  8. Add the Visualforce page to a page layout.

    After you create the page, add it to the relevant object page layout.

  9. From Setup, go to the object you want to update (for example, Account or Email Message).
  10. Open Page Layouts, and select the layout you want to edit.
  11. In the palette, select Visualforce Pages.
  12. Drag your Visualforce page into a section on the layout.
  13. Click the wrench icon (Properties) for the Visualforce page, and configure these settings.
    • Width (Pixels or %): 100%
    • Height (Pixels): at least 400 (or 600 for the list component)
    • Show scrollbars: selected
  14. Click OK, and then save your changes.
Warning
Warning If the Archive component appears blank, verify that Lightning Out is enabled in your org and that users have the required Archive App permissions.
 
Loading
Salesforce Help | Article