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