I am trying to retrieve the body of ContentDocument after insert. Below is my code.My trigger is on ContentDocument (After Insert)
public static void syncContentDocument(List<ContentDocument> documentList) {
for (ContentDocument attach : documentList) {
contentIds.add(attach.id);
}
//create content document body map
for (ContentVersion content : [SELECT Id,Title,VersionData FROM ContentVersion WHERE ContentDocumentId IN : contentIds AND IsLatest = true]) {
bodyContent.put(content.Id, content.VersionData);
}
System.debug('contentIds' + contentIds);
System.debug('bodyContent' + bodyContent);
}
But I am getting empty result from debug logs. Could anyone please help me to do this?