# Creating & Managing Controlled Document Templates

With controlled document templates, you can create and manage templates using regular Vault documents as the template source file. Controlled document templates use a _Steady_ state Vault document as the template document. Documents created from the controlled document template use the Vault template document as the source file.

You can only create a controlled document template after an Admin completes the necessary configurations. See [Configuring Controlled Document Templates](/en/lr/46025/) for detailed instructions.

## Creating Controlled Document Templates {#creating}

To create a controlled document template:

  1. Navigate to any Vault Library document that is not in the _Steady_ state. This document will be the source file when users create a document from the template.
  2. In the _Template Document Type_ field, select a location where the template will appear in the document type hierarchy. See details about the [_Template Document_ Type field][2] below. If this field doesn't appear, you can't create a controlled document template for documents of this type.
  3. Transition the document to the _Steady_ state.

When the document enters the _Steady_ state, Vault automatically creates a new controlled document template. The template inherits its name from the document by default, unless an Admin has [defined](/en/lr/5509/#edit) it differently. The template is immediately available for use when users create a document from a template, although it may take a few minutes for the template to appear in **Business Admin > Templates**.

You can select the same _Template Document Type_ for multiple documents, but you can only use a given document as the source file for one controlled document template.



<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Controlled document templates are converted to basic document templates during cloning or refreshing. This is because the template’s Vault document is not retained in a cloned or refreshed Vault. However, once this document is added to the new or refreshed Vault, you can <a href="/en/lr/5509/#converting">convert</a> the basic template. See also <a href="/en/lr/48988/#configurationcopying">Administering Sandbox Vaults</a>.</p>
    </div>
  </div>
</div>



### Using Vault Loader to Create Controlled Document Templates

Users with access to the [Vault Loader](/en/lr/26605/) can create controlled document templates by loading documents in _Steady_ state with the _Template Document Type_ field populated. When the load is complete, Vault creates the controlled document templates automatically.

### Creating Controlled Document Templates with Document Migration Mode {#document-migration-mode}

Vault can create controlled document templates with [Document Migration Mode](/en/lr/54028/) enabled when using the <a class="external-link " href="https://developer.veevavault.com/api" target="_blank" rel="noopener">Create Multiple Documents API<i class="fa fa-external-link" aria-hidden="true"></i></a> or [Vault Loader: Create Documents](/en/lr/26605/).

Controlled document template creation is disabled when using the <a class="external-link " href="https://developer.veevavault.com/api" target="_blank" rel="noopener">Create Multiple Document Versions API<i class="fa fa-external-link" aria-hidden="true"></i></a> or [Vault Loader: Add Document Versions](/en/lr/26911/) with Document Migration Mode enabled. 

### About the Template Document Type Field {#template-document-type}

The _Template Document Type_ field controls the template's position in the document type hierarchy, which defines the document type for which the controlled document template appears when you create a document from a template.

For example, if you set the _Template Document Type_ field to **Reference Materials**, the template only appears when you select the _Training > Material > Reference Material_ document type. If you set the _Template Document Type_ field to _Base_, the template will appear for all document types.

You can assign controlled document templates to any location in the document type hierarchy, regardless of the template document's classification.

You can create a reference constraint using the object's _Enabled_ field on the _Template Document Type_ shared field to display only active document types in the _Select Document_ dialog.

## Updating Controlled Document Templates

You can update a controlled document template in two ways:

  * Versioning a document and approving the new version to _Steady_ state. Vault updates the existing controlled document template with the latest _Steady_ state version of the template document source file.
  * Selecting a different location in the document type hierarchy via the _Template Document Type_ field and re-approving the document to _Steady_ state. Vault updates the existing controlled document template and moves it to the new position in the document type hierarchy.

## Deleting Controlled Document Templates {#deleting}

Neither Admins nor Vault users can directly delete controlled document templates once they are created. However, Vault deletes controlled document templates in the following circumstances:

  * When the existing version of the template document moves out of its _Steady_ state
  * When you delete the template document or its latest _Steady_ state version
  * When you clear the value in the _Template Document Type_ field and re-approve the document to _Steady_ state

Deleting a template document has no impact on the existing documents already created from the template. When a source document of a controlled template moves from a _Steady_ state to a _Superseded_ state, the related controlled document template is not deleted. 

## Creating Documents from Controlled Templates

Users create documents from controlled document templates in the same way as basic document templates. When users create documents from templates, there is no visual distinction between basic document templates and controlled document templates. See [Creating Documents](/en/lr/15085/#template) for more information about creating documents from templates.

## Document Relationships

When you create a document from a controlled document template, Vault automatically creates a _Based On_ document relationship to allow for traceability. You can see this relationship in the Doc Info Fields Panel of a document created from a template, or in the template document's **Where Used** view. You can also run document relationship reports for the _Based On_ relationship. See details about [reporting][7] below.

### Original Source with Controlled Document Templates

If your Admin enables original source tracking, Vault can also keep track of the original source document using the _Original Source_ relationship. For example, Gladys has a _WonderDrug NA_ document. She assigns a _Template Document Type_ to her document, approves it to _Steady_ state, and Vault creates a new _WonderDrug NA Template_. She then creates a document from the _WonderDrug NA Template_, which she names _WonderDrug USA_. On _WonderDrug USA_, she assigns a _Template Document Type_, approves it to _Steady_ state, and Vault creates a new _WonderDrug USA Template_. She creates a document from the _WonderDrug USA Template_, which she names _WonderDrug East_. The _Original Source_ relationship for _WonderDrug East_ is her _WonderDrug NA_ document.

## Reporting {#reporting}

You can run [document relationship reports](/en/lr/32722/) using the _Based On_ and _Original Source_ document relationships and filtering on the _Template Document Type_ field. For example, a _Copy with Original_ report type with the filters _Original > Template Document Type is not blank_ and _Copy > Template Document Type is blank_ would return all documents created from templates, along with their relationship to the template document.

## Audit Trail

The audit trail for a document derived from a controlled document template includes the _Based On_ relationship, the _Original Source_ relationship (if enabled), and an event that lists the controlled document template used and the template document that is the source file: '_Document created from template "`<template name>`" using template document "`<template document number>` (`<template document version>`)"._' For example, 'Document created from template "_WonderDrug NA Template_" using "PM-WD-00001 (1.0)".'

The audit trail on a template document includes an event each time the _Template Document Type_ is set or reset. For example, "Template Document Type set to Form."

 [1]: #document-migration-mode
 [2]: #template-document-type
 [7]: #reporting
