How to update Content Organizer Logs for version 5.7

Posted on by Let's Strategize


When Content Organizer version 5.7 was released for Salesforce CRM, it provided access to reporting fields. If you already have Content Organizer installed in your instance and upgraded to v5.7, you must run the following script after the package upgrade has completed in the developer console. This will update the Log object records so you will have the data populated for the v5.7 reports.

Please find the CO Log script with Product name:

Map<String, List<LS_CO__CO_Log__c>> logMap = new Map<String, List<LS_CO__CO_Log__c>>();
List<LS_CO__CO_Log__c> logs = [select LS_CO__ContentId__c , LS_CO__Content_Title__c, LS_CO__Content_Description__c,
                               LS_CO__Content_Tag__c, LS_CO__Content_Owner__c, LS_CO__Content_FileType__c,
                               LS_CO__Content_LastModifiedDate__c, LS_CO__Content_CreatedDate__c from LS_CO__CO_Log__c
                               where LS_CO__ContentId__c != null ];
for(LS_CO__CO_Log__c cl :logs){
    if(cl.LS_CO__ContentId__c != null){
        if(!logMap.containsKey(cl.LS_CO__ContentId__c))logMap.put(cl.LS_CO__ContentId__c, new List<LS_CO__CO_Log__c>());
Map<Id, ContentVersion> cvMap = new Map<Id, ContentVersion>([Select Title, LastModifiedDate, Description, TagCsv, OwnerId, Id, FileType, Owner.FirstName, Owner.LastName, ContentSize, ContentDocumentId, Origin, PublishStatus, ContentUrl, PathOnClient, CreatedDate From ContentVersion where Id in :logMap.keySet()]);
for(String cId :logMap.keySet()){ if(cvMap.containsKey(cId)){ ContentVersion cv = cvMap.get(cId); for(LS_CO__CO_Log__c cl :logMap.get(cId)){ cl.LS_CO__Content_Title__c = cv.Title; cl.LS_CO__Content_Description__c = cv.Description; cl.LS_CO__Content_Tag__c = cv.TagCSV; cl.LS_CO__Content_Owner__c = cv.OwnerId; cl.LS_CO__Content_FileType__c = cv.FileType; cl.LS_CO__Content_LastModifiedDate__c = cv.LastModifiedDate; cl.LS_CO__Content_CreatedDate__c = cv.CreatedDate; } } }
update logs;

If you require assistance, please contact us at and one of our team members will get in touch with you.