Page tree
Skip to end of metadata
Go to start of metadata

Document Templates Table

The Document Templates table is a background table that holds a record for each document template used by the Contracts table or other system tables. It also keeps track of the Version Number of the attached document template document, and defines which Contract Types can use the document template in the Available for Contract Types field.

Use Case

Document Templates can be created and edited by admins and Contract Managers. The ID, Title, Template File, and Version Number fields are pulled into the Contracts table as a link to selected fields from another table. These are filtered to Document Templates whose Available for Contract Types field contains the Contract Type selected in the current Contract record. If multiple Document Templates are available for a Contract Type, the default value for the Document Template to Generate in the Contract is matched to the Default Document Template Title and Document Template File fields of the selected Contract Type. An Abbreviation field is used in the resulting file name, so it is useful to populate any new Document Templates with a reasonable abbreviation.

You can also add a document template without contract information, variables, or formulas, to the Document Template record using the Blank Form field. This field is used to provide a template of the document, without the metadata. This option can give potential suppliers a chance to review the conditions of the document without including specific information. Essentially, the blank form should be considered as a preview of the contract terms. 

The document uploaded to the Blank Form field should not use conditions. For example, if a clause only appears in the contract for contracts valued above $10M, you should decide whether or not to include this in the blank form document as it can be sent to potential suppliers before the contract value is decided as part of the Sourcing Event. Once the Sourcing Event has a Selection Approved, a final contract is generated using the full document template. 

Inserting Variables into Document Templates

Document Templates may include field variables from the table on which the template is run, as well as from any table in the system. For instance, a template might have the text $contract_start_date in the place where the start date of the contract should appear.

It may also pull in clauses from the clause library without creating a link to that clause within the contract. A special syntax is used for fields and records that do not live in the main table from which the template is run:

$field_from_other_table(clause,41,clause_text)is used to indicate that the Clause Text field, or clause_text, for record with ID 41 in the Clause table should be inserted into the document template at this position. For more information about the syntax, see Embedding Tables and Fields from Tables.

Document Templates should reference the variables for Clause records in the Clause Library, not the variables for Document Template Clause records. This is especially important for enabling proper compatibility with the Agiloft Add-in for Microsoft Word.

Conditional Text, Fields, and Content

There are several ways to insert conditions into a document template to use alternative text or alternative values. These are described in Document Template Syntax Reference. It is common to have Document Templates with optional or conditional sections that may or may not appear when the template is run, based on meta data in the contract.

Numbering of Sections

If the document template is using HTML text fields either from the contract, or from clauses in the clause library, and you need section numbering with the contract, there are some special challenges with deciding what kind of numbering methodology to use. Auto-numbering can be used within the HTML clause field itself, within the template, or within the style used in the conversion.

In the standard implementation, the numbering and indentation style is set in the document template, applied to the relevant clause variable. However, sometimes the HTML text that replaces the variable in the template does not retain the numbering or indentation. If you see this issue in your Document Templates, you can choose to insert the auto-numbering HTML code inside the clause text, instead of in the document template. To do so, edit the clause in Source HTML and insert the MS Word auto-numbering code at the front of the clause text. When the document is generated, this code automatically assigns a sequential number and applies list indentation. Note that if you use this method, these numbers are reassigned every time the document is opened, which means the clauses are always shown as recently modified when a contract is edited.

Auto-numbering Code
<agiloft_tag_fc fc="al_fc_start LISTNUM LegalDefault \l 1 al_fc_end"></agiloft_tag_fc>

In the standard implementation, we handle numbering in the document template, not the clause text. Whichever method you choose, make sure to test it thoroughly.

For more information on how these Document Templates interact with a clause library, please read the Clause Library Table section.


Document Template records are owned by their creator. Specifically, a Document Template record is owned by the user whose Login matches the Creator Login field.

1 Comment

  1. user-cb86e

    This is linking to articles "behind the firewall" in the Implementation space.