Create an Author and Typist Custom Field for Documents

Create an Author and Typist Custom Field for Documents

  1. --In Document Management systems that have Author and Typists,
  2. --Universal Migrator generally maps columns as follows:
  3. --Typist (the actual person who created the document) = Final_Created_By_Id
  4. --Author (the person the typist created the document for) = Final_Created_OnBehalfOf_Id
  5. --
  6. --It is expected that Author and Typist reference values from the __M_Users although some systems
  7. --Do allow these to have their own custom picklist values.
  8. --
  9. --These scripts will do the following:
  10. -- * Create Author and Typist custom field definitions
  11. -- * Create __M_CustomField_Presets (Picklist items) for each based on the __M_Users
  12. -- * Create Custom Field Values for each document that represent the Author and Typist.
  13. --
  14. -- Please note that this script is a TEMPLATE that is designed to be 
  15. -- Customized per your scenario.


  16. --Create the Author Field
  17. INSERT INTO __M_CustomField_Definitions (
  18.     Id,
  19.     Final_Kind,
  20.     Final_Subject,
  21.     Final_Parent_Type
  22. VALUES (
  23.     'Author',
  24.     '__M_CustomField_Presets',
  25.     'Author',
  26.     '__M_Documents_Digital_Files'
  27. )

  28. --Create Author picklist items based on users
  29. INSERT INTO __M_CustomField_Presets (
  30.     Id,
  31.     Final_CustomFieldDefinition_Id,
  32.     Final_ReferenceCode,
  33.     Final_Subject
  34. )
  35. SELECT
  36.     CONCAT('Author --- ', Id),
  37.     'Author',
  38.     Final_UserName, --We're using the UserName as the reference code.  Maybe use Final_ReferenceCode
  39.     Final_FullName  --The picklist item is the user's full name.
  40. FROM
  41.     __M_Users

  42. --Now create the author's custom field value
  43. INSERT INTO __M_CustomField_Values (
  44.     Id,
  45.     Final_CustomFieldDefinition_Id,
  46.     Final_Parent_Id,
  47.     Final_Parent_Type,
  48.     Final_Value
  49. )
  50. SELECT
  51.     CONCAT(Id, ' --- ', 'Author'),
  52.     'Author',
  53.     Id,
  54.     '__M_Document_Digital_Files',
  55.     CONCAT('Author --- ', Final_Created_OnBehalfOf_Id)
  56. FROM
  57.     __M_Documents_Digital_Files
  58. WHERE 1=1
  59.     --Ignore blank items so we don't create garbage
  60.     AND Final_Created_OnBehalfOf_Id != ''
  61.     --Ignore items that don't map to a valid user so we don't create errors.
  62.     AND Final_Created_OnBehalfOf_Id IN (SELECT Id FROM __M_Users)
  63.     
  64.         
  65. --Create the Typist Field
  66. INSERT INTO __M_CustomField_Definitions (
  67.     Id,
  68.     Final_Kind,
  69.     Final_Subject,
  70.     Final_Parent_Type
  71. VALUES (
  72.     'Typist',
  73.     '__M_CustomField_Presets',
  74.     'Typist',
  75.     '__M_Documents_Digital_Files'
  76. )

  77. --Create Typist picklist items based on users
  78. INSERT INTO __M_CustomField_Presets (
  79.     Id,
  80.     Final_CustomFieldDefinition_Id,
  81.     Final_ReferenceCode,
  82.     Final_Subject
  83. )
  84. SELECT
  85.     CONCAT('Typist --- ', Id),
  86.     'Typist',
  87.     Final_UserName, --We're using the UserName as the reference code.  Maybe use Final_ReferenceCode
  88.     Final_FullName  --The picklist item is the user's full name.
  89. FROM
  90.     __M_Users

  91. --Now create the Typist's custom field value
  92. INSERT INTO __M_CustomField_Values (
  93.     Id,
  94.     Final_CustomFieldDefinition_Id,
  95.     Final_Parent_Id,
  96.     Final_Parent_Type,
  97.     Final_Value
  98. )
  99. SELECT
  100.     CONCAT(Id, ' --- ', 'Typist'),
  101.     'Typist',
  102.     Id,
  103.     '__M_Document_Digital_Files',
  104.     CONCAT('Typist --- ', Final_Created_By_Id)
  105. FROM
  106.     __M_Documents_Digital_Files
  107. WHERE 1=1
  108.     --Ignore blank items so we don't create garbage
  109.     AND Final_Created_By_Id != ''
  110.     --Ignore items that don't map to a valid user so we don't create errors.
  111.     AND Final_Created_By_Id IN (SELECT Id FROM __M_Users)
  112.     
  113.         
    • 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 ...