Embedding the Vault Viewer in Approved Email Content

There are two ways to display Vault content to a recipient of an Approved Email:

  • Standalone Vault Viewer – The default document viewer that email recipients use to view Vault documents
  • Embedded Viewer – Content creators can embed the Vault document viewer in a custom portal site, enabling customers to retain control of branding and augment the document with additional portal content. The embedded viewer is built using a small HTML snippet that renders the document within its own iFrame.

Adding the Embedded Vault Viewer to a Web Page

To use the Embedded Viewer in a customer portal page, add the following HTML snippet to the appropriate page. The viewer can be embedded in multiple pages.

Copy
<div align="center" id="viewer"></div>
<!-- The iFrame and Vault Viewer replaces the above <div> tag. The id of the <div> matches the first parameter of the viewer constructor. -->
<script>
  var tag = document.createElement('script');
  tag.src = "https://js.veevavault.com/vault.js";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
  // This function creates an <iframe> (and vault viewer) after the API code downloads.
  var viewer;
  function onVeevaVaultIframeAPIReady() {
    viewer = new VV.Viewer('viewer', {
      height: '630',
      width: '712',
      error: 'Sorry. The document you are trying to view is not available.'
    });
  }
</script>

The above snippet creates an iFrame whose size can be defined in pixels using the height and width parameters. An optional error message can be defined inline using the error parameter. This displays when the target is no longer in an approved or steady state in Vault.

Linking to Pages with the Embedded Vault Viewer

When the link to a page with the embedded Vault viewer is added to a template or fragment, the URL is stored in the Document_Host_vod field on the corresponding Approved_Document_vod record.

Viewing Multiple Documents in the Embedded Vault Viewer

The Vault Viewer enables users to access all documents referenced by the Approved Documents (Email Template and Email Fragments) in Vault without returning to the email to select each one individually.

When the recipient selects one of the documents included in an email, the Multi-Doc View in Vault displays the document along with a thumbnail of each of the documents included in the email. The recipient can then select and view each of the documents from within the Vault Viewer.

Thumbnails only display for valid, non-expired documents. If a document expires after the email is sent, but before the recipient accesses it, a thumbnail does not display for that document.