Template Versioning provides a solution framework of document versioning at the Template level to track template versions against generated documents. Your organization's policies, requirements, legal and business practices may change over time, requiring templates to be updated. Rather than manually keeping track of template iterations, you can use template versioning to track and manage every version of your template throughout its lifecycle. Template versioning maintains those different versions as the template changes, giving template admins the ability to activate specific template versions based on their needs, and to observe how the template looked at every stage in the authoring process. Template versioning applies to both agreement and clause templates in your library.

In short, template versioning allows template admins to:

  • Survey older contracts by viewing their associate template version to understand what was in the template at generation.
  • Revert to previous template versions.
  • Clone template versions to begin a new template lifecycle.
  • Publish updated clauses and nested clauses across specific template versions.
  • Understand the growth and evolution of a given template.

How Template Versioning Works

Each agreement or clause template in your org (with or without template versioning enabled) always consists of one template, and multiple child references to clauses and sections contained in that template. For every instance of that template, there is always only one template which can be considered active (the version selected by the user to generate the contract or the version of the clause inserted into an agreement template).

More specifically, whenever a new template is created by any means, one instance of the template is created, stored in the Template object in Salesforce, and any clauses or dynamic sections nested in the template are stored in the Template Clause Reference and Template Dynamic Section objects respectively. The Template object has a master-detail relationship to both child objects, as shown in the following figure.

What Template Versioning does is preserve the same template, we'll call it the "Header Template," which has a one-to-one relationship with the Active Version of the template and its child objects, and a one-to-many relationship with other versions of the template, which also have versioned clause and section references, but are considered inactive.

Template Versioning introduces three new objects:

  • Template Version – a detail object of the master Template object
  • Template Clause Reference Version – a child object of Template Version that stores nested clause references
  • Template Dynamic Section Version – a child object of Temple Version that stores dynamic section references

When a user creates a new version of a template, the version information is incremented (e.g. from "1.0" to 2.0") but stored in the Template Version object and its child objects, NOT the Template object, creating a separate record of that template version. After creation, when and if a template version becomes the active version, data from the Template Version objects are copied to the Header Template objects and that template version becomes the new active version of the Header Template.