Auto-filing templates

Auto-filing can take documents from the FDA Inbox, Manage Imports, Automatic document importation, Print to FileHold, the Microsoft Office integration, the Add Document Wizard, and WebCap scanner inbox and file them into the appropriate folders using information like metadata field values to determine the correct library location. This feature helps reduce misfiling and enables faster mass importation of documents.

Library administers or higher roles can apply auto-filing to document schemas by configuring auto-filing templates. Configuring auto-filing templates may require some technical knowledge about regular expressions and merge tags, depending on how complicated the template needs to be. The FileHold Professional Services team can assist with creating auto-filing templates.

When creating the templates, the library objects (cabinet, drawer, folder group, and folder) need to be defined. Structure can be automatically created or not. If creating structure, a “template” can be selected from the current structure which is used to copy the ownership, membership or default schema, unless otherwise specified.

The templates are validated for correctness. The validation errors must be corrected before the template can be saved. The rules for template validation are:

  • Name cannot be empty.
  • There must be at least one condition in each section.
  • Folder must be set if template can create library objects.

The rules for library object validation are:

  • Name cannot be empty.
  • Search and match fields must be set or both should be null.
  • Match must be a valid regular expression.
  • Merge tags used in search and name must be valid.

For other auto-filing options, see Auto-filing Settings.

To create an auto-filing template

  1. Go to the Administration panel > Library configuration > Auto-filing templates.
  2. Click Add.
  3. In the General tab, enter a Template name for the template.
  4. Enter a Description for the template.
  5. In the Schemas where used area, the schema names that use this template are listed. This field cannot be modified and is blank when creating a new template.
  6. Click Next.
  7. The Summary tab displays a summary of the library object definition. This is blank until the properties are defined. To define or edit a library level, click Edit Eden icon or select the Cabinet, Drawer, Folder Group or Folder tab.
  • If the library definition is created and validated, examples of what the library structure will be is shown. The test values can be modified in the Test values tab.
  1. Click Next.
  2. In the Library properties tab, enable the Auto-filing can create library objects check box if the template can create library structure: cabinets, drawers and folders. If the check box is disabled, then new library structure cannot be created by the auto-filing template.
  • In the Library properties template field, select a folder from the current library structure to base membership, ownership, color, and other properties from for the newly created structure. This option is only enabled if the Auto-filing can create library objects check box is enabled. Click Apply.

If folder properties from which the template is based upon changes, this also updates the auto-filing template for any new documents added. For example, a different owner or folder color changes.

  • Select the Set folder owner to current user check box if the newly created folder structure should have the current user as the owner of the folder.
  • Select the Set default schema to current schema check box if the default schema for the newly created folder structure should be the same as the schema being used to create the folder.
  1. Click Next.
  2. In the Cabinet, Drawer, Folder Group, or Folder tab, click Add Add icon to define the library object settings. Many conditions can be defined per library object.
  3. Enter the following library object auto-filing settings and click Update. If creating a folder group, enable the Include folder group check box.

Cabinet name

Drawer name

Folder group name

Folder name

This field is required. You can use a combination of fixed text and zero or more merge tags to form the name.

For example, [[md|Vendor]] - [[sys|now|yyyy]] would produce a library object name starting with the vendor, then a hyphen, then the current year. If the vendor was "Acme" and it was January 20, 2021, the name would be Acme - 2021.

If you are using the search / match fields, the "replace" merge tag is also available. See Using the “replace” merge tag with auto-filing templates.

For examples see Auto-filing template examples.

DescriptionEnter a description for the setting. This field is not required.
Search /  Match

You can create an arbitrary number of library object name definitions when you use the search and match fields. This pair allows you to use a regular expression to create a conditional name. If the regular expression entered in the match field finds a matching pattern from the contents of the search field, this name field will be used to name the library object. Any captured data from the regular expression can be used in the name with the replace merge tag. 

You can enter any combination of sys or md merge tags and text in the search field. You will add a regular expression designed to inspect the contents of the search field, in the match field.

For example, you want the drawer to be named after the two letter state code, but the state field could contain many different formats for the state. Set the search field to the value from the state metadata field.


Set the  match field to your regular expression, like the following:

California|Cali|CA|Golden State

Set the name field to CA.

If you want to match more states like this, just add another name definition for each state you would like to name.

How to create regular expressions is not a subject for this knowledge base as it is a common industry methodology and technology, but many good resources are available on the internet for both learning about and testing regular expressions. FileHold uses the standard Microsoft dot NET regular expression libraries, so you should reference resources referring to do NET as there are minor differences between regular expression interpreters.


  1.  Click Next.
  2.  In the Test Values tab, sample values to validate the configuration are shown. Each field is treated as a text field. Enter your own values to validate with in the fields. These values persist along with the rest of the auto-filing configuration. If a merge tag field is removed from a name, its corresponding test value is erased. In cases where the match is used, there is a test value representing each match case. Each value has an arbitrary default value from the following list:
  • Text: "Text field"
  • Dropdown menu: First option in the list.
  • Multi-select dropdown menu: First two options in the list.
  • Drilldown menu: First child node in the tree along with its parents and separator as appropriate according to the configuration.
  • Currency: 123.45
  • Numeric: 987.65
  • Checkbox: True
  • URL:
  • Any date: Today's date and time.
  • Any user related field: Current user.
  • Document control number: The DCN prefix followed by the last DCN, or if there is no document yet created the next DCN, or if no starting value simply the number 1 with the appropriate leading zeros.
  • Version control number: VER1
  • FileHold id: Next document id.
  • Document version: 1
  • Document name: My document name
  • Workflow template: My workflow template
  • Workflow name: My workflow name
  • Schema name: My schema name
  1. At any point in the auto-filing template configuration, click Validate. The configuration is validated and displays the message “Validation completed without errors” on the Summary tab.
  • If there are errors, the message “Some validation errors were found. Please, correct them and try again” displays. The configuration settings require modification if this message appears.
  1. Click Save to save the auto-filing template.
  2. Click Close Close icon to close the template.
  3. Ensure that auto-filing is enabled for the system.
  4. Apply the auto-filing template to the document schema.
  5. Test the auto-filing template by adding a document using one of the following methods: FDA Inbox, Manage Imports, Automatic document importation, Print to FileHold, the Microsoft Office integration, the Add Document Wizard, or WebCap scanner inbox.
  6. Make any modifications to the auto-filing template as needed.

Using the “replace” merge tag with auto-filing templates

The “replace” merge tag can be used in the Cabinet/Drawer/Folder Group/ Folder Name field in more advanced auto-filing templates. It is used in conjunction with the Search and Match fields in the library object definition. It allows for the replacement of a value when the search and match conditions are met. At this time, the replace tag can only be used with auto-filing. Knowledge of merge tags and regular expressions are required to use the replace merge tag. For examples of using the replace tag, see Using the Search, Match fields and “replace” merge tag.

How to manipulate the auto-filing template view

The auto-filing template list can be modified to add or remove columns, resize or change the order of the columns, sort ascending or descending, filter the results, and save these different views. See How to manipulate the watermark template view for more information.

Exporting the auto-filing templates list

The auto-filing template list can be exported out to a PDF, Excel, or CSV file. See Exporting the watermark templates list for more information.

Auto-filing template examples

Below are some auto-filing template examples from simple to advanced cases. For all examples, on the Name and Description are required fields.

1. Simple auto-filing template

A simple example of an auto-filing template is:

  • A cabinet “Accounting”.
  • A drawer “AP Invoices”.
  • A folder “All invoices".

For the cabinet, drawer, and folder settings in the auto-filing template, only a Name and Description is required to set the document location. The Search and Match fields are left blank.

Simple auto-filing template example

Here is the Summary page for the configuration:

Simple auto-filing template example 2

2. Auto-filing template using merge tags

Merge tags can be used to set the cabinet, drawer, folder group, and folder location. A list of all merge tags can be found here.

In this example:

  • Cabinet is “Accounting”.
  • Drawer is “AP Invoices”. The merge tag [[sys|document-schema]] is used in the Name field.
  • Folder group is the invoice year. The merge tag [[md|Invoice Date|yyyy]] is used in the Name field.
  • Folder is the vendor name. The merge tag [[md|Vendor]] is used in the Name field.
Merge tag auto-filing template example

Here is the Summary page for the configuration:

Merge tag auto-filing template example 2

When a document is added via the FDA inbox, the destination folder is set to “Accounting/AP Invoices/2019/BC Hydro” based on the document schema and metadata.

Merge tag auto-filing template example in Inbox


3. Using the Search, Match, and merge tag fields

Merge tags can be used in conjunction with the Search and Match fields to create library structure when certain conditions are met. In this case, the HR department manages employees all over North America and want to add their employee information files into the FileHold library. They want their folders to be based on the “Province/State” metadata field value and preceded with the country prefix “CAN-“ or “USA-“.

For the first folder condition, it is matching on the short State code:

  • Name: USA-[[md|State/Province]]
  • Description – USA folders
  • Search: [[md|State/Province]]

For the second folder condition, it is matching on the short Province or Territory code:

  • Name: CAN-[[md|State/Province]]
  • Description: Canadian folders
  • Search: [[md|State/Province]]
  • Match: ^(?:(AB|BC|MB|N[BLTSU]|NFL|NWT|ON|PEI|QC|SK|YT)).*$
Merge tag and search auto-filing template example

Depending on the selection made in the State/Province drop-down metadata field, the folder is created based on the condition rules. In the example below, the province “BC” was selected from the State/Province metadata field so the folder name is “CAN-BC”.

Merge tag and search auto-filing template example 2

3a. Checkbox fields

Another common scenario is cases where checkbox metadata fields are used. These fields return values of True or False which are generally not useful in library object naming. However, these values can be easily converted to more logical names with a very simple search / match combination. For example, if you have a checkbox to indicate if a document is private or not, you could set auto-filing to place the document in the "Private" or "Public" folder with a simple search / match where the search is your checkbox metadata field and the match is "True" or "False".

4. Using the Search, Match fields and “replace” merge tag

The “replace” merge tag can be used to replace the value matched in the Match and Search fields with some other value.

In this example, accident and health insurance (A&H) policies are being added to the FileHold library.

  1. For the cabinet, the name is Accident and Health Insurance (A&H).
  2. For the drawer, the name should be restricted to the City and Province of the policy. The city name is prefixed with the province abbreviation.
  • For condition 1:
  • Name: [[replace|BC-${city}|Error in BC address]]
  • Description: BC cities
  • Search: [[md|Policy location]]
  • Match: ^(?<city>\w*), BC$
  • For condition 2:
  • Name: [[replace|AB-${city}|Error in AB address]]
  • Description: AB cities
  • Search: [[md|Policy location]]
  • Match: ^(?<city>\w*), AB$
  • For condition 3:
  • Name: [[replace|ON-${city}|Error in ON address]]
  • Description: ON cities
  • Search: [[md|Policy location]]
  • Match: ^(?<city>\w*), ON$
  1. For the folder groups, the name should be restricted to the first five digits of a nine-digit Policy Number. A “GR” precedes the number.
  • Name: [[replace|GR-${1}]]
  • Description: First 5 digits of 9-digit policy number
  • Search: [[md|Policy No.]]
  • Match: ^(\d{5})\d{4}$
  1. For the folders, the Last Name of the Policy Holder and name of the Dependent are combined.
  • Name: [[md|Last Name]]-[[md|Dependent name]]
Merge tag and search auto-filing template example 3
Merge tag and search auto-filing template example 4

For assistance with auto-filing templates, contact the FileHold professional services team at [email protected].