View Archived Content Documents Under Non-Archived Emails

Configure a Visualforce page that displays email messages alongside their related archived Content Documents within the CustomListRelatedRecordArchivedWidget and CustomSingleRelatedRecordArchivedWidget in the Archive managed package.

Note
Note This content relates to Archive. For Salesforce Archive, see Store Data Externally with Salesforce Archive.

The instructions apply to both Salesforce Classic and Lightning Experience.

Note
Note

You must have access to Visualforce pages.

  1. Create a Visualforce Page.
    1. Click New to create a Visualforce page for the selected email object.
    2. Enter a Label for the page.
      Example: archiverecords_for_email_message
    3. Enter a Name.
      Use underscores instead of spaces.

      Example: archiverecords_for_email_message

    4. In the Visualforce Markup section, enter this code.
      
                                      <apex:page standardController="EmailMessage">
                                      <apex:includeLightning />
                                      <div id="lightning" />
                                      <div id="showErrornotSuported"></div>
                                      
                                      <style>
                                      lightning-breadcrumb.slds-breadcrumb__item {
                                      text-align: center !important;
                                      }
                                      
                                      .toastModel {
                                      height: 4rem !important;
                                      position: fixed !important;
                                      top: 0rem !important;
                                      left: 50% !important;
                                      transform: translateX(-50%) !important;
                                      z-index: 100000 !important;
                                      }
                                      </style>
                                      
                                      <script>
                                      let lwcArchiverApp = "OB_Archiver:lwcWrapperAppForVisualforce";
                                      let widgetComp = "OB_Archiver:CustomRelatedSingleResults";
                                      $Lightning.use(lwcArchiverApp, function () {
                                      $Lightning.createComponent(widgetComp,
                                      {
                                      recordId: "{!<a href="http://EmailMessage.Id" rel="noopener" target="_blank">EmailMessage.Id</a>}",
                                      objectApiName: "EmailMessage",
                                      defaultChildObject: "ContentDocument"
                                      },
                                      "lightning",
                                      function (cmp) {
                                      }
                                      );
                                      });
                                      </script>
                                      </apex:page>
                                  
    5. Click Save.
  2. Add the widget to the Page Layout in Salesforce Classic.
    1. In Setup, go to the object's layout and click Edit Layout.
    2. Create a section in the object layout.
    3. From the Components menu, select the Visualforce Page option.
    4. In Section Properties, select either CustomListRelatedRecordArchivedWidget or CustomSingleRelatedRecordArchivedWidget, or both.
    5. Enter a Section Name for the new section.
    6. Check the Detail Page checkbox and select 1-Column.
    7. Drag the page to the new section.
    8. Click the Properties icon on the Visualforce page.

      Set the Height to 500 and turn on the Show Scrollbars option.

    9. Click Save.

      The new widgets are now visible on the page layout.

  3. Verify the Display
    1. Go to an EmailMessage record in Archive.
    2. The widget displaying the archived Content Document is now visible.
    3. The content of the archived document, fetched from Archive, appears under the Details tab.