Last date modified: 2026-May-18

Automate document assembly based on field values

Document Assembly generates new Word documents by combining assembly templates with field values from your reviewed contracts. You create a template with tokens, map those tokens to Relativity fields, and then run an analysis to produce new documents populated with the extracted data.

Assembly templates as building blocks

Assembly templates are the building blocks of document assembly models. An assembly template in Contracts is essentially a Word document with enhanced capabilities. When you add tokens to the Word document, you can later map those tokens to fields in Relativity to fill them in with data.

For example, if your Word document has the phrase "Effective as of {{effective_date}}," you can later map this {{effective_date}} token to the Effective Date field in Relativity to fill in the actual date of the contract in place of the {{effective_date}} token in the Word document.

If the effective date is March 3rd, 2017 Contracts will generate a new Word document and the new phrase will read "Effective as of March 3rd, 2017."

Tokens cannot contain spaces. In the example, the token must be {{effective_date}}, not {{effective date}}.

Assembly templates support advanced functions that you can embed alongside tokens. For example, you can use conditional logic to include or exclude content based on what data populates a token.

The following function categories are supported in assembly templates:

Function Scope
Date functions All functions supported
Math All functions supported
Strings All functions supported
Regex All functions supported
Code blocks Only single-line expression statements supported

For details on syntax and usage for these functions, contact Relativity support.

Creating an assembly template

To create a new assembly template:

  1. Go to the Contracts Assembly Templates tab.
  2. Click New Contracts Assembly Template.
  3. Name your assembly template.
  4. Add a description.
  5. Select a file to upload from your computer and use as a template.
    This must be a Word document.
  6. Click Save

Running document assembly

To generate a new Word document for every document in your data source based on your assembly template and field-to-token mapping:

  1. Go to the Contracts Models tab.
  2. Click New Contracts Model.
  3. Name your model.
  4. For Model Type, select Document Assembly.
  5. Enter a description.
  6. On the Assembly Template card, select the assembly template you created.
  7. On the Output Control Number card, enter text to append to the control number that Contracts generates for each new Word document.
  8. Click Save.

To set up token mapping:

  1. On the Token Mapping list, click Edit.
  2. From the list of tokens on the right, move the tokens you want to map into the middle area. You can drag, double-click, click once and then click the left arrow, or click Move All. You can also type to filter for specific tokens.
  3. From the list of fields on the left, move the fields you want to map into the middle area using the same methods.
    You can only map the following field types: fixed-length text, long text, whole number, decimal, date, single choice, and yes/no.
  4. Drag to reorder your fields and tokens in the middle area as needed.
  5. Click Save.

The modal will close and your mapping should be accurately reflected in the Token Mapping list.
An image of a completed Token Mapping list.

Use the Use Previous Mapping drop-down to select an existing document assembly model. Contracts auto-maps the fields to tokens for you.

To set up an analysis profile and run analysis:

  1. Go to the Analysis Profile tab.
  2. Click New Contracts Analysis Profile.
  3. Enter a name and description for the analysis profile.
  4. On the Document Assembly tab, add the model you created.
  5. Click Save.
  6. Go to the Analysis Set tab.
  7. Click New Contracts Analysis Set.
  8. Name your analysis set.
  9. Choose the analysis profile you created.
  10. Select a saved search to run the analysis on.
  11. Click Analyze.

Outputs generated by Contracts

For every document in the saved search of your analysis set, Contracts will generate a new Word document in Relativity.

Control number of the new Word document

The new Word document will have a control number that includes the control number of the original document in the saved search used to generate it.

For example, if you ran your analysis set on a saved search with a document that had the control number "Enphase Lease," the control number of the newly assembled Word document will have the following control number: Enphase Lease_htk_new_[random 3 character ID].

If you choose to append text to this control number, the new control number will be: Enphase Lease_htk_new_[random 3 character ID] [your custom text].

Fields on the new Word document

The new Word Document will inherit all the field values from the original document in the data source used to generate it.

For example, if there are 10 fields with values populated on Document 1, after running document assembly the new Word document will have the same 10 field values, including Contracts Related Documents. Therefore the Word document will appear in the Related Items Pane in the Contracts Viewer.

Supported field types that can be mapped to tokens

You can map the following field types to tokens on an assembly template:

  • Single choice
  • Multiple choice
  • Single object
  • Multiple object
  • Long text
  • Fixed-length text
  • Date
  • Currency
  • Whole Number
  • Decimal
Contracts also supports mapping to fields that have the Open to Associations setting enabled. This setting determines whether a field on one object type can display related data from an associated object type. These fields are sometimes called reflected fields.
Return to top of the page
Feedback