Synthesize: Missing Document Categories for Documents

Synthesize: Missing Document Categories for Documents

The following script will synthesize document categories for invalid Final_DocumentCategory_Id values on documents.

  1. -- Some documents are linked to categories that no longer exist.
  2. -- Create dummy document categories based on these values.
  3. INSERT INTO
  4. __M_Documents_Digital_Categories (
  5. Id,
  6. Final_ReferenceCode,
  7. Final_Subject
  8. )
  9. SELECT DISTINCT
  10. Final_DocumentCategory_Id,
  11. Final_DocumentCategory_Id,
  12. Final_DocumentCategory_Id
  13. FROM
  14. __M_Documents_Digital_Files
  15. WHERE 1=1
  16. AND Final_DocumentCategory_Id != ''
  17. AND Final_DocumentCategory_Id NOT IN (SELECT Id FROM __M_Documents_Digital_Categories)



    • Related Articles

    • Synthesize Missing Matters for Documents

      Some systems only allow documents to be linked to matters. These scripts will allow you to restore data into these systems. When Matters No Longer Exist The following script with synthesize matters for document related to matters that no longer ...
    • Synthesize Missing Practice Areas

      The following SQL script will create practice areas where they do not exist in the Matters table. --Synthesize missing practice areas from Matters INSERT INTO __M_Matters_PracticeAreas( Id, Final_Subject ) SELECT DISTINCT Final_PracticeArea_Id, ...
    • Synthesize Missing Client Contacts for Matters

      This script below will create dummy contacts where the Matter is assigned to a contact that no longer exists. --Some of the Matters are linked to contacts that no longer exist. --This will create dummy contacts from the missing links. INSERT INTO ...
    • Create Contact Categories from Matter Participants

      --The following script will create Contact Categories from the roles --that Contacts are linked to on Matters and then assign the contacts to those categories. GO INSERT INTO __M_Contacts_Categories ( Id, Final_Subject ) SELECT DISTINCT ...
    • Promoting Document Versions into Documents

      --The following playbook is a TEMPLATE that you can use to promote all document versions into actual documents. --When a document has a category, append the folder with the document category ID. UPDATE __M_Documents_Digital_Files SET --Prepend the ...