# Configuring Record History (QMS)

The Record History feature allows users to capture a configurable snapshot of a record at a point in time (such as approval or closure) that contains all pertinent information for the record and its related records per your business needs. This supports a wide variety of scenarios across your Quality Vault, for instance, capturing the current state of a Supplier when its qualification changes are approved, or a globally spanning _Change Control_ upon its closure.  The record's history can be quickly and clearly displayed to an inspector or auditor during quality processes such as investigations of nonconformances or complaints, without having to leave the record's detail page.

This feature utilizes [Quality Document Generation](/en/lr/72016/) to generate a document that contains the data from an object record, capturing a snapshot of the record each time it is approved or closed. A list of these documents is displayed in the _Record History_ section along with document fields that are populated with data from the record at the time of document generation. Users can click on the documents to view each snapshot of the record. The _History Details_ section provides an inline display of the most recently captured snapshot of a record. When a user navigates to the record in a closed or approved state, Vault displays the latest version of the document that represents the record at the time of closure. When users [download the record as a PDF](/en/lr/44069/#download-as-pdf), the historical data displayed on the record is included in the PDF.

## Supported Objects

Record History supports all standard QMS and Product Surveillance objects. Standard objects are those with a `__qdm` or `__v` namespace.

## Configuration Overview

Complete the following steps to configure the Record History feature:

1. [Configure][1] document fields
2. [Configure][2] objects
3. [Configure][4] document generation
4. [Configure][5] user permissions

## Configuring Document Fields {#doc-fields}

Generated historical documents can be any document type in your Vault. Once you select a document type for generated documents, you must add fields to the document type to store field values from the corresponding record at the time of document generation. These values are displayed as plain text in the _Record History_ section of object records, and populated in the document metadata fields of each generated document.

The fields you add must be [required](/en/lr/592/#attributes) and have the same data type and API name as the source object field, excluding the extension (for example, `__c` or `__v`). When populating fields during document generation, if there's more than one field with a matching name, Vault prioritizes standard fields (fields with a `__v` extension).

## Configuring Objects {#objects}

To use the Record History feature, you must make the following changes to the supported object.

### Configuring the Document Reference Field {#hr-field}

The standard _History Record_ document reference field stores a link to the latest version of the historical snapshot of a record. This field is available on a subset of standard QMS objects. Activate the _History Record_ document reference field and add it to the relevant object types.

If required by your business process or configuration, you can optionally use a different standard or custom document reference field.

### Configuring the Record History Section {#rh-section}

The _Record History_ section displays documents containing historical versions of a record, and data populated into document fields from object fields on the record at the time of document generation. Users can click on a document displayed in this section to view the full snapshot of the record. When selecting lifecycle states in which to display the section, do not select any closed states.

To configure:

1. [Navigate](/en/lr/26387/#how-to-access-page-layouts) to the appropriate object layout.
2. Click **Insert Section**.
3. Select the **Record History** section type.
4. Enter a **Section Label**.
5. In the **Show the section only in these lifecycle states** field, select the appropriate lifecycle states. 
6. Enter the API name of the **Document Field** that references generated history documents. If you are using the standard _History Record_ field, this value should be `history_record__v`.
7. Select the **Document Type** for generated documents.
8. Select the **Fields to Display**. These are document metadata fields that Vault populates with values from the originating record when generating a document. You can select up to 25 fields.
9. Click **Done**.
10. Click **Save**.

### Configuring the History Details Section {#hd-section}

In lifecycle states with the _History Details_ section configured, when users navigate to a record, the version of the record at the time of closure or approval displays. To configure the _History Details_ section:

* Add the _History Details_ section and select the relevant lifecycle states in which to display the section. These should be closed and approved states. Enter the **Document Field** that references the generated history document. If you are using the standard _History Record_ field, this value should be `history_record__v`.
* [Create](/en/lr/51632/#creating-layout-rules) layout rules with a [_Hide_ display effect](/en/lr/51632/#about-display-effects) to hide:
    * The _History Details_ section on all lifecycle states except the closed or approved state.
    * All sections except for _History Details_ when records are in a closed or approved state.
* As an alternative to configuring the layout rules in the above step, you can instead [create](/en/lr/26387/#object-type-layout) another layout for the object that displays only when a record in a closed or approved state, and configure it in the following ways:
    * [Create](/en/lr/51632/#creating-layout-rules) a layout rule with a [_Focus On_ display effect](/en/lr/51632/#about-display-effects) for the layout and select only closed or approved states.
    * [Create](/en/lr/51632/#creating-layout-rules) a layout rule with a [_Hide_ display effect](/en/lr/51632/#about-display-effects) for the layout to hide it in non-closed or approved states.
    * [Create](/en/lr/582159/#how-to-create-layout-profiles) a layout profile for the layout.
    * [Add](/en/lr/582159/#how-to-add-users) the relevant users to the layout profile.

## Configuring Document Generation {#doc-gen}

To use the Record History feature, you must configure your Vault to generate a document from the record and populate a reference to the generated document into the [_History Record_ field][6]. To do this, configure the [_Generate Document From Formatted Output_ action](/en/lr/72016/#fo-action) as an entry action on a closed or approved lifecycle state, or the [_Generate Document from Record Layout_ job](/en/lr/72016/#workflow-step) to run on a workflow step that corresponds to a closed or approved state of the lifecycle. Each time the record reaches the configured lifecycle state or workflow step, Vault generates a document from the record, adds it to the _Record History_ section, and stores the link to the document in the _Record History_ field on the record. If the record is in a closed or approved state, the latest version of the document displays.

When configuring document generation, ensure you select the same **Document Type** that you selected when [adding the _Record History_ section][3].

## User Permissions {#user-permissions}

To utilize the Record History feature, users require the following permissions:

* _Edit_ permission for all relevant supported objects.
* _Read_ permission for the _Record History_ field on each target object.
* _Read_ permission for the _Record History_ document reference field on the target object.
* _View_ permission for the _Record History_ and _History Details_ object controls.
* _View_ permission for the _History Details_ page.
* _View_ permission for the relevant document types.

## Related Permissions

To configure the Record History feature, you must have the following permissions:

<table>
  <tr>
   <th>Type</th>
   <th>Permission Label</th>
   <th>Controls</th>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Document Fields: Edit</td>
   <td>Ability to edit and configure document fields.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Formatted Output Records: Create</td>
   <td>Ability to create new formatted outputs.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Jobs: Create</td>
   <td>Ability to create job definitions.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Object Lifecycles: Edit</td>
   <td>Ability to edit and configure object lifecycles.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Object Workflows: Edit</td>
   <td>Ability to edit and configure object workflows.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Objects: Edit</td>
   <td>Ability to edit and configure Vault objects.</td>
  </tr>
  <tr>
   <td>Security Profile</td>
   <td>Admin: Permission Sets: Edit</td>
   <td>Ability to edit and configure permission sets.</td>
  </tr>
</table>

[1]: #doc-fields
[2]: #objects
[3]: #rh-section
[4]: #doc-gen
[5]: #user-permissions
[6]: #hr-field