Moving Documents into Matters that are Nested under Invoices
- --The following script moves documents that are nested under Invoices to be nested under Matters instead.
- UPDATE
- __M_Documents_Digital_Files
- SET
- Final_Folder_RelativePath = '\Invoices\',
- Final_Parent_Type = Relationships.Final_RelatedTo_Type,
- Final_Parent_Id = Relationships.Final_RelatedTo_Id
- FROM
- __M_Documents_Digital_Files Documents,
- __M_Financial_AR_Invoices Parents,
- __M_Financial_AR_Invoices_Related_Entities Relationships
- WHERE 1=1
- AND Documents.Final_Parent_Type = '__M_Financial_AR_Invoices'
- AND Documents.Final_Parent_Id = Parents.Id
- AND Parents.Id = Relationships.Final_ArInvoice_Id
- AND Relationships.Final_RelatedTo_Type = '__M_Matters'