Exportfile for AOT version 1.0 or later Formatversion: 1 ***Element: JOB ; Microsoft Dynamics AX Job: removeDocentricDocumentTypes unloaded ; -------------------------------------------------------------------------------- JOBVERSION 1 SOURCE #removeDocentricDocumentTypes #static void removeDocentricDocumentTypes(Args _args) #{ # // Docentric Report DocuType for Archiving. # #define.DocReportArchiveDocuTypeId('DOCReport') # # // Docentric Report DocuType for Attachments. # #define.DocReportAttachDocuTypeId('DOCFile') # # // DocuAction class names for Docentric Document Libraries. # #define.DocTemplatesFSActionClassName('DocDocuActionFileSystem') # #define.DocTemplatesSPActionClassName('DocDocuActionLibrary') # # ClassId docTemplatesFSActionClassId = className2Id(#DocTemplatesFSActionClassName); # ClassId docTemplatesSPActionClassId = className2Id(#DocTemplatesSPActionClassName); # # DocuType docentricDocuType; # DocuRef docentricDocuRef; # PrintJobHeader docentricPrintJobHeader; # DocuValue docentricDocuValue; # # # try # { # // 1) Clean up Reports, Print Archives and Attachments # info('Cleaning up Docentric SSRS and Basic Report Document Types - Print Archive and Attachments...'); # # ttsBegin; # # // Delete from Print Archive. # delete_from docentricPrintJobHeader where docentricPrintJobHeader.jobType == #DocReportArchiveDocuTypeId; # # // Delete from DocuRef -> Cascading Deletion from DocuValue. # while select forUpdate docentricDocuRef # where docentricDocuRef.TypeId == #DocReportArchiveDocuTypeId || # docentricDocuRef.TypeId == #DocReportAttachDocuTypeId # { # docentricDocuRef.delete(); # } # # // Delete from DocuType. # while select forUpdate docentricDocuType # where docentricDocuType.TypeId == #DocReportArchiveDocuTypeId || # docentricDocuType.TypeId == #DocReportAttachDocuTypeId # { # docentricDocuType.doDelete(); # } # # ttsCommit; # # info('Docentric SSRS and Basic Report Print Archive and Attachments have been successfully cleaned up.'); # # # // 2) Clean up Docentric Document Libraries. # info('Cleaning up Docentric Document Libraries...'); # # ttsBegin; # # if (docTemplatesFSActionClassId || docTemplatesSPActionClassId) # { # while select forUpdate docentricDocuType # where docentricDocuType.ActionClassId == docTemplatesFSActionClassId || # docentricDocuType.ActionClassId == docTemplatesSPActionClassId # { # // Delete from DocuRef -> Cascading Deletion from DocuValue. # while select forUpdate docentricDocuRef # where docentricDocuRef.TypeId == docentricDocuType.TypeId # { # docentricDocuRef.delete(); # } # # // Delete from DocuType. # docentricDocuType.doDelete(); # } # } # else # { # while select forUpdate docentricDocuType # { # if (classId2Name(docentricDocuType.ActionClassId)) # { # continue; # } # # // Delete from DocuRef -> Cascading Deletion from DocuValue. # while select forUpdate docentricDocuRef # where docentricDocuRef.TypeId == docentricDocuType.TypeId # { # docentricDocuRef.delete(); # } # # // Delete from DocuType. # docentricDocuType.doDelete(); # } # } # # ttsCommit; # # info('Docentric Document Libraries have been successfully cleaned up.'); # } # catch # { # error('Cleaning up Docentric Document Types failed.'); # } #} ENDSOURCE PROPERTIES Origin #{F921E76F-9DDA-45C0-B5D8-DA47293E6EC7} ENDPROPERTIES ***Element: END