Schema-based auto-filing script

The Schema-Based auto-filing script has many configuration options compared to the other included auto-filing scripts. Documents can be filed based on:

  • A document schema name. The schema name is used as the level in the library hierarchy.
  • A metadata field value. The value in the metadata field is used as a level in the library hierarchy.
  • A fixed value. A fixed value is defined in the configuration and is used as a level in the library hierarchy.
  • A system value which includes 'created date', 'document schema name', or 'document name'

All filing methods can be used with any level in the library structure. For example, a cabinet can be a fixed value, the drawer can be the schema name, and the folder can be a metadata field value. Alternatively, a cabinet can be a schema name, the drawer can be a metadata field value and the folder is a fixed value. The script can be set to create the library structure as needed if the logged in user has a sufficiently privileged role.

Multiple regular expressions can also be used. If one fails to return a non-empty string, the next one is tried and so on until the first match is found.

The name of the script is called Schema-Based.dll and is located in C:\Program Files\FileHold Systems\Application Server\LibraryManager\AutoFiling. There is a separate configuration file for this script called Schema-BasedAuto-FilingScript.xml located in the same directory (do not attempt to modify the AutofilingMembersip.xml file for this script).

FileHold Professional Services can assist in the creation of auto-filing scripts if needed. Contact [email protected] for assistance.

Configuration of the Schema-BasedAuto-FilingScript.xml file

For each level in the hierarchy, there is an option in the configuration file to allow the level entity to be created automatically or not. If the level entity can be created, there must be a matching definition. The default schema is used in the definition when creating folder or cabinet entities. For example:

<Name>Schema-Based</Name>

    <DocumentSchemas>

      <DocumentSchema name="schemaname1"><!-- Must exactly match a schema in order to be effective; otherwise exception will be thrown -->

        <Cabinet createable="true"><!-- Defaults to false, if true, all other sub levels automatically true -->

Level entities based on schema name

When configured to use a schema name, the level entity will be the document schema name. For example:

<Mapping type="SchemaName" />

Level entities based on fixed values

When configured to use a fixed value, the level entity will be defined the fixed value. For example:

<Mapping type="Fixed">

   <Value>Invoices</Value>

</Mapping>

Level entities based on metadata fields

For level entities based on metadata fields, text, drop-down, drill-down, numeric and date fields can be used.

  • Text and drop downs can be modified by a regular expression. For example:

<Mapping type="MetadataField">

            <Field>textFieldName</Field>

            <Properties fieldType="Text">

              <Regex search="^(.{3})-{0,1}(.{3})-{0,1}(.{3})" replace="$1-$2-$3" /><!--It's optional-->

            </Properties>

</Mapping>

 

<Mapping type="MetadataField">

            <Field>dropDownName</Field>

            <Properties fieldType="DropDownMenu">

              <Regex search="^(.{3})-{0,1}(.{3})-{0,1}(.{3})" replace="$1-$2-$3" /><!--It's optional-->

              <Delimiter>" "</Delimiter><!--In case of multi select drop down menus; Quotation marks are not required-->

            </Properties>

</Mapping>

  • Drill-down fields need to have the level specified in the configuration. In other words, if only the items in the 3rd level of the drill-down menu can be used as the level entity, you will need to enter “3” in the configuration. For example:

<Mapping type="MetadataField">

            <Field>drilldownFieldName</Field>

            <Properties fieldType="DrillDownMenu">

              <Level>3</Level>

            </Properties>

       </Mapping>

<Mapping type="MetadataField">

            <Field>dateFieldName</Field>

            <Properties fieldType="Date">

              <Format>YYYY-MM-dd HH:mm:ss.ff</Format><!--Value has to be compatible with .NET DateTime formatting-->

            </Properties>

</Mapping>

 

<Mapping type="MetadataField">

            <Field>numberFieldName</Field>

            <Properties fieldType="Numeric">

              <Format>X2</Format<!--Value has to be compatible with .NET Decimal formatting-->

            </Properties>

</Mapping>

Level entities based on system values

For level entities based on created date, document schema name, or document name.

Created date example:

<Mapping type="SystemField">

          <Field>CreatedOn</Field><!--When mapping is of SystemField type, only following fields are allowed: CreatedOn, DocumentSchema, DocumentName.-->

          <Properties fieldType="Date">

              <Format>yyyy MM</Format>

          </Properties>

</Mapping>

Document name example:

<Mapping type="SystemField">

          <Field>DocumentName</Field>

          <Properties fieldType="Text">

          </Properties>

</Mapping>

 

Document schema example:

<Mapping type="SystemField">

          <Field>DocumentSchema</Field>

          <Properties fieldType="Text">

          </Properties>

</Mapping>

Defining cabinet and folder owners and membership

When creating cabinets and folders, their owners and members need to be defined in the Schema-BasedAuto-FilingScript.xml file.  To generate the GUIDs that define the users and groups in the system, run the Export Guids function in FHIT. See Configuring the AutofilingMembership.xml File for detailed instructions.

Once the GUID file is created, use it to assign owners and members to folders and cabinets. For example:

<Properties>

            <Owner>5fbb1943-1ff3-4a9c-b48a-5040046d9951</Owner>

            <Weight>0</Weight>

            <Members>

              <Member>85aa74d2-cc60-434a-b277-5666cf19da75</Member>

              <Member>77d95a70-1185-4200-b483-dc71f8507b8b</Member>

              <Member>b40240cd-1f52-4456-b347-ec0885570778</Member>

              <Member>eb1e7de0-4a7d-46da-9207-680b04923192</Member>

              <Member>544cd72f-5857-4d50-be7b-65f834f714db</Member>

            </Members>

</Properties>

Weighting and folder colour

For cabinets, drawers, folder groups, and folders the weight for each level entity can be specified in the configuration file. The range of values is 10 to -10. The lower the weight (such as -10), the higher the folder name appears in the Library. The higher the weight (such as 10), the lower the folder name appears in the list. Leave the weight at 0 if you want the folder groups sorted alphabetically. For example:

<Properties>

     <Weight>0</Weight>

 </Properties>

 

For folders, the colour of the folder can be specified as yellow, blue, green or red. The default colour is yellow.

<Color>Red</Color><!--Allowed values: Blue, Green, Red, Yellow; use Yellow if empty-->

Regular expressions

Regular expressions is a special text string for describing a pattern. A pattern consists of one or more character literals, operators, or constructs. For a brief introduction, see .NET Framework Regular Expressions. Multiple regular expressions can be used in the auto-filing configuration. If one fails to return a non-empty string, the next one is tried and so on until the first match is found.

For example:

<Drawer>

        <Mapping type="SystemField">

          <Field>DocumentSchema</Field>

          <Properties fieldType="Text">

            <Regex search="^(.{3})-{0,1}(.{3})-{0,1}(.{3})" replace="$1-$2-$3" /><!--It's optional-->

          </Properties>

        </Mapping>

        <Properties>

          <Weight>0</Weight>

        </Properties>

      </Drawer>

<Folder>

        <Mapping type="SystemField">

          <Field>DocumentName</Field>

          <Properties fieldType="Text">

            <Regex search="^[ACC]{3}.*" replace="Acceptance" /><!--Optional. There can be defined any number of Regex patterns. First matching pattern will be used.-->

            <Regex search="^[SET]{3}.*" replace="Settlement" />

          </Properties>

        </Mapping>

        <Properties>

          <Owner>dddddddd-dddd-dddd-dddd-dddddddddddd</Owner>

          <Weight>10</Weight>

          <Color>Green</Color>

          <Members inherit="true" />

        </Properties>

      </Folder>

Example configuration

The following table outlines an example configuration:

For FileHold 15, if the Folder Group level is not going to be used, the level must be removed from the XML file altogether. In FileHold 14, leaving the parameter empty was valid.

Library Level

Scenario 1

Scenario 2

Cabinet

Document schema name

Fixed "Department"

Drawer

Fixed “Active Members”

Period metadata

Folder Group

Unused

Tax Code metadata

Folder

Badge # metadata

Area metadata

 

Sample code for the Schema-BasedAuto-FilingScript.xml file:

<?xml version="1.0" encoding="utf-8" ?>

<AutoFilingScripts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <AutoFilingScript>

    <Name>Schema-Based</Name>

    <DocumentSchemas>

      <DocumentSchema name="schemaname1"><!-- Must exactly match a schema in order to be effective; otherwise exception will be thrown -->

        <Cabinet createable="true"><!-- Defaults to false, if true, all other sub levels automatically true -->

          <Mapping type="SchemaName" /><!--Allowed values: SchemaName, Fixed, MetadataField; exception will be thrown if empty-->

          <Properties>

            <Owner>dddddddd-dddd-dddd-dddd-dddddddddddd</Owner><!--Use current user's Guid if empty-->

            <Weight>0</Weight>

            <Members>

              <Member>dddddddd-dddd-dddd-dddd-dddddddddddd</Member>

            </Members>

          </Properties>

        </Cabinet>

        <Drawer>

          <Mapping type="Fixed">

            <Value>Active Members</Value>

          </Mapping>

          <Properties>

            <Weight>-8</Weight>

          </Properties>

        </Drawer>

       <Folder>

          <Mapping type="MetadataField">

            <Field>Badge #</Field>

            <Properties fieldType="Text"><!--Allowed values: Text, Numeric, Date, DrillDownMenu, DropDownMenu; exception will be thrown if empty-->

              <Regex search="^(.{3})-{0,1}(.{3})-{0,1}(.{3})" replace="$1-$2-$3" /><!--It's optional-->

            </Properties>

          </Mapping>

          <Properties>

            <Owner>dddddddd-dddd-dddd-dddd-dddddddddddd</Owner><!--Use current user's Guid if empty-->

            <Weight>0</Weight><!--Use 0 if empty-->

            <Color>Red</Color><!--Allowed values: Blue, Green, Red, Yellow; use Yellow if empty-->

            <Members inherit="true">

              <Member>dddddddd-dddd-dddd-dddd-dddddddddddd</Member>

            </Members>

          </Properties>

        </Folder>

      </DocumentSchema>

      <DocumentSchema name="schemaname2">

        <Cabinet createable="false">

          <Mapping type="Fixed">

            <Value>Department</Value>

          </Mapping>

          <Properties>

            <Owner>dddddddd-dddd-dddd-dddd-dddddddddddd</Owner>

            <Weight>0</Weight>

            <Members>

              <Member>dddddddd-dddd-dddd-dddd-dddddddddddd</Member>

            </Members>

          </Properties>

        </Cabinet>

        <Drawer>

          <Mapping type="MetadataField">

            <Field>Period</Field>

            <Properties fieldType="Date">

              <Format>yyyy</Format><!--Value has to be compatible with .NET DateTime formatting-->

            </Properties>

          </Mapping>

          <Properties>

            <Weight>0</Weight>

          </Properties>

        </Drawer>

        <FolderGroup>

          <Mapping type="MetadataField">

            <Field>Tax Code</Field>

            <Properties fieldType="DrillDownMenu">

              <Level>3</Level> <!--Specify the node in the drill down choice-->

            </Properties>

          </Mapping>

          <Properties>

            <Weight>4</Weight>

          </Properties>

        </FolderGroup>

        <Folder>

          <Mapping type="MetadataField">

            <Field>Area</Field>

            <Properties fieldType="Numeric">

              <Format>C</Format><!--Value has to be compatible with .NET Decimal formatting-->

            </Properties>

          </Mapping>

          <Properties>

            <Owner>dddddddd-dddd-dddd-dddd-dddddddddddd</Owner>

            <Weight>0</Weight>

            <Color>Blue</Color>

            <Members inherit="false">

              <Member>dddddddd-dddd-dddd-dddd-dddddddddddd</Member>

            </Members>

          </Properties>

        </Folder>

      </DocumentSchema>

    </DocumentSchemas>

  </AutoFilingScript>

</AutoFilingScripts>

Once the Schema-BasedAuto-FilingScript.xml is configured, then you can set up the auto-filing configuration for the schema in the library administration area. See Automatically Filing Documents into the System for more information.