Create an Author and Typist Custom Field for Documents
- --In Document Management systems that have Author and Typists,
- --Universal Migrator generally maps columns as follows:
- --Typist (the actual person who created the document) = Final_Created_By_Id
- --Author (the person the typist created the document for) = Final_Created_OnBehalfOf_Id
- --
- --It is expected that Author and Typist reference values from the __M_Users although some systems
- --Do allow these to have their own custom picklist values.
- --
- --These scripts will do the following:
- -- * Create Author and Typist custom field definitions
- -- * Create __M_CustomField_Presets (Picklist items) for each based on the __M_Users
- -- * Create Custom Field Values for each document that represent the Author and Typist.
- --
- -- Please note that this script is a TEMPLATE that is designed to be
- -- Customized per your scenario.
- --Create the Author Field
- INSERT INTO __M_CustomField_Definitions (
- Id,
- Final_Kind,
- Final_Subject,
- Final_Parent_Type
- )
- VALUES (
- 'Author',
- '__M_CustomField_Presets',
- 'Author',
- '__M_Documents_Digital_Files'
- )
- --Create Author picklist items based on users
- INSERT INTO __M_CustomField_Presets (
- Id,
- Final_CustomFieldDefinition_Id,
- Final_ReferenceCode,
- Final_Subject
- )
- SELECT
- CONCAT('Author --- ', Id),
- 'Author',
- Final_UserName, --We're using the UserName as the reference code. Maybe use Final_ReferenceCode
- Final_FullName --The picklist item is the user's full name.
- FROM
- __M_Users
- --Now create the author's custom field value
- INSERT INTO __M_CustomField_Values (
- Id,
- Final_CustomFieldDefinition_Id,
- Final_Parent_Id,
- Final_Parent_Type,
- Final_Value
- )
- SELECT
- CONCAT(Id, ' --- ', 'Author'),
- 'Author',
- Id,
- '__M_Document_Digital_Files',
- CONCAT('Author --- ', Final_Created_OnBehalfOf_Id)
- FROM
- __M_Documents_Digital_Files
- WHERE 1=1
- --Ignore blank items so we don't create garbage
- AND Final_Created_OnBehalfOf_Id != ''
- --Ignore items that don't map to a valid user so we don't create errors.
- AND Final_Created_OnBehalfOf_Id IN (SELECT Id FROM __M_Users)
-
-
- --Create the Typist Field
- INSERT INTO __M_CustomField_Definitions (
- Id,
- Final_Kind,
- Final_Subject,
- Final_Parent_Type
- )
- VALUES (
- 'Typist',
- '__M_CustomField_Presets',
- 'Typist',
- '__M_Documents_Digital_Files'
- )
- --Create Typist picklist items based on users
- INSERT INTO __M_CustomField_Presets (
- Id,
- Final_CustomFieldDefinition_Id,
- Final_ReferenceCode,
- Final_Subject
- )
- SELECT
- CONCAT('Typist --- ', Id),
- 'Typist',
- Final_UserName, --We're using the UserName as the reference code. Maybe use Final_ReferenceCode
- Final_FullName --The picklist item is the user's full name.
- FROM
- __M_Users
- --Now create the Typist's custom field value
- INSERT INTO __M_CustomField_Values (
- Id,
- Final_CustomFieldDefinition_Id,
- Final_Parent_Id,
- Final_Parent_Type,
- Final_Value
- )
- SELECT
- CONCAT(Id, ' --- ', 'Typist'),
- 'Typist',
- Id,
- '__M_Document_Digital_Files',
- CONCAT('Typist --- ', Final_Created_By_Id)
- FROM
- __M_Documents_Digital_Files
- WHERE 1=1
- --Ignore blank items so we don't create garbage
- AND Final_Created_By_Id != ''
- --Ignore items that don't map to a valid user so we don't create errors.
- AND Final_Created_By_Id IN (SELECT Id FROM __M_Users)
-
-
Related Articles
Create a "Legacy Matter Number" Custom Field
Some firms rely heavily on Matter Numbers to search for a specific matter. Sometimes when they migrate to a new system it can't replicate the automatic numbering system from their old system so they want to renumber all their matters to a new scheme ...
Create a "Legacy Client Number" Custom Field
Some firms rely heavily on Client Numbers to search for a specific client. Sometimes when they migrate to a new system it can't replicate the automatic numbering system from their old system so they want to renumber all their matters to a new scheme ...
Create an "Employer" Contact from a Custom Field.
In some systems, contacts do not have an Employer relation and only have a text field that represents the employer. This script will help when moving firms into platforms that allow an actual contact to be specified for the employer. --Create Company ...
Copy a Custom Field into a Core Field
Some systems don't have certain core fields and clients often create a custom field that they use instead. The following script will let you copy values from a custom field named 'Opened' into __M_Matters.Final_Date_Opened . You can adjust this ...
Custom Field Kinds
The following is a list of the valid Kinds of custom fields. Kind Notes TextLine TextArea HtmlArea Number Represents any kind of number. Integer Represents only whole numbers Money Date Time TimeSpan Represents durations. DateTime EmailAddress ...