Options
All
  • Public
  • Public/Protected
  • All
Menu

Redirecting Relativity Viewers

Redirecting Relativity Viewers

You can redirect Relativity viewers to display different content. The Review Interface includes the Item Load Transform feature, which allows an extension to modify the content that a viewer displays.

The Review Extensions define IItemLoadTransform objects, including an ItemLoadTransformFn object. This object determines how the viewer is redirected. Use this feature to display an RDO file or a different document in an existing Relativity viewer.

The following code sample illustrates how an extension script redirects the Native Viewer to display a different document:

(function (parameters) {
  var getDocumentIdToRedirectTo = function (originalDocumentId) {
    // ...
    return someOtherDocumentId;
  };

  return {
    id: "relativity.review.test.viewerTransform",
    name: "Viewer Transform Test Extension",
    itemLoadTransforms: [
      {
        viewerType: "native",
        conflictBehavior: "register",
        transformFn: function (api, viewerCard, item, options) {
          var newItem = item;
          if (item.artifactId) {
            var newId = getDocumentIdToRedirectTo(item.artifactId);
            newItem = api.queue.createDocumentItem(newId);
          }
          return {
            item: newItem,
            options: options,
          };
        },
      },
    ],
  };
})(params);