Page tree

Creating Document Templates with the Word App

Document templates, formerly print templates, make it easy to create documents using consistent, standardized language that insert information specific to the situation. For example, you might have an NDA template that includes standard and approved contractual text, with the parties' names, addresses, and other information inserted based on the data in the record.

This makes it easy to generate standard documents quickly and with confidence that they follow the necessary procedures.

We recommend using the Agiloft Contract Assistant for Word to build and edit document templates. Every session must end by clicking Save (or Publish Changes), otherwise templates will fail to work if opened in the template editor.

Creating a Template

When you build a new document template, begin with an existing, finalized contract sample in .docx format that is a good representation of your organization's best practices. Then, use the Word app to replace specific parts of the sample document's text with variables that call values from a record.

To create a document template using the Agiloft Contract Assistant for Word, follow the steps below.

  1. Choose a sample document to use as the basis of the template. Save it as a local file, and open it in Microsoft Word.
  2. Click the Agiloft logo in the Home ribbon. If you don't see a logo, you might need to Install the Agiloft Contract Assistant for Word.
  3. Sign in to the KB where you want to create the document template.
  4. Click Create new template.
  5. Complete the basic information about the template:
    1. Title: Enter the title of the template.
    2. Description: Give an optional description of what sort of contract this template represents, how it should be used, etc.
    3. Status: Determine whether this document template should be Active or Inactive.
    4. Publication Level: Determine who can view this document template.
    5. Related To: Determine what records this document template is related to. If you select Contracts, you can then link this document template to specific contract types. This way, you can be sure you are only using a document template with the right kind of contracts.
    6. eSignature Type: Select whether this document template is signed using Adobe Sign or DocuSign. 
  6. Click Create. After you click Create, you can still edit the details and link additional contract types, either here in Word or in the Document Templates table of the KB.
  7. The pane now shows the template information you entered, and offers the option to Scan and Convert syntax into labels. Real-world documents don't generally include any document template syntax, so you don't need to use this option. This tool is useful when editing or troubleshooting existing templates.
  8. Highlight content in the document that needs to be generic for the template, or otherwise needs to be connected to the KB so that it can be kept up to date. These might include:
    • Variables. These represent field values from the record. For example, you might tag variables like Company Name, Contract Start Date, or Contract Amount. To tag a variable, highlight the text in the document and then click Add > Variable.
    • Clauses. These represent standard clauses, or blocks of text, from your clause library. For example, you might tag a Limitation of Liability clause, or Force Majeure clause. To tag a clause, highlight the entire clause in the document and then click Add > Clause. Be careful with your highlighting, because all the highlighted text is replaced by the contents of the tagged clause. Clauses tagged in a template are updated if their corresponding records are updated in the KB.
    • Signatures. These support electronic signature by the document's recipients, constructed according to the syntax of the e-signature vendor you selected in step 5. To tag a signature, highlight the signature line and click Add > Signature.
  9. As you go, you might encounter content, tagged or otherwise, that should only be included under certain circumstances. For these:
    1. First, enter or locate the text you want to show only under certain conditions.
    2. Select the text, being careful to select or not select punctuation as desired, and then click Add > Condition.

      This adds a $startif function, for those familiar with document template syntax. 

    3. Give a clear name to the condition so you can identify it in the pane.
    4. Select the variable, or field, that determines whether the text is shown.
    5. Select the appropriate operator, such as "is" or "is greater than".
    6. Enter the value you're evaluating. For example, to show text only when the Amended field is Yes, you would enter Yes for the value.
    7. Click Save (or Publish Changes). The selected text is now included only if the specified condition is met. If the condition is not met, the text is not included in the output file.
  10. Select or clear the checkboxes for different element types to show or hide them in the app. For large templates with many tags, this makes editing easier. For example, you might want to hide the variable tags when you finish with them, since there are often many discrete variables tagged in a template.
  11. Below the element types, you can switch between Showing Labels or Showing Syntax.

    Some complex expressions are not yet supported by the template designer and must be entered manually in syntax mode.
  12. When you finish tagging, click Save (or Publish Changes) a final time in the pane. If you want to save the file, you can, but a copy has already been saved to the document template record.
  13. Finally, test your template to make sure the output looks correct. Document templates often require some trial and error to get the formatting to look exactly right.

Editing a Template

If you want to edit an existing template, you can easily tag the existing document template syntax and make additional changes directly in the app.

  1. Open the document template file in Word.
  2. Click the Agiloft logo in the Home ribbon.
  3. Sign in to the KB where you want to create the document template, and wait while the Word app retrieves information about the template.
  4. Below the template information from the KB, click Scan and Convert. The Scan and Convert button appears whenever a template is open in the template editor, if the Word app isn’t yet aware of any expressions in the document. Clicking the button scans the document for all $variable syntax expressions, and then converts them into labels. Label view makes it easier to add or edit expressions as $variable syntax expressions are replaced with their descriptive labels. Note that if you are using the Showing Syntax feature, this process does not change the appearance of the syntax. 
  5. In the Tags pane, you can see all the identified tags. Click the Showing toggle to see natural language labels for all the identified tags. Keep in mind that some syntax isn't supported with natural language labels, but that syntax can still be parsed by the system even if you don't tag it, so you don't need to remove it or change it.
  6. Add any variables, tags, signatures, or conditions as you go.
  7. When you finish tagging, click Save (or Publish Changes) a final time in the pane. This saves your changes to the document template record. If you fail to publish changes after making an update, your template will not work.
  8. Finally, test your template to make sure the output looks correct. Document templates often require some trial and error to get the formatting to look exactly right.

Syntax Mode and Label Mode

A document must contain $variable syntax to be recognized by the Agiloft template engine. When the variables themselves are visible in the document template, this is called syntax mode. Syntax mode is useful for editing and troubleshooting purposes. Whenever the Word app saves your document back to the KB, the document is converted to syntax mode.


While syntax mode offers a basic view of the variables that are included in the template, label mode allows you to view the template with plain language instead of variable syntax. To change the view from syntax mode to label mode, use the toggle on the Tags pane. If nothing has been tagged yet, you can click the Scan and convert button to have the Word app automatically identify existing $variable tags in the document.

After the document template syntax has been scanned and converted, the values that correspond to the variables are populated into the template in label mode. They are given content controls that provide descriptive labels, and coloration is improved.