5

Both ContentDocument and ContentVersion have a ContentSize field documented to be:

Size of the document in bytes

but after adding debug code to check that field for both types for these events:

trigger ContentDocumentTrigger on ContentDocument (
        before insert,
        before update,
        before delete,
        after insert,
        after update,
        after delete
        ) {
    cve.Notes.handle(
            Trigger.operationType,
            Trigger.old,
            Trigger.new,
            Trigger.oldMap,
            Trigger.newMap
            );
}

it appears that the ContentSize does not change when the content is updated from Apex code i.e. it remains at its original value in both ContentDocument and ContentVersion (though a new version is created).

Is there any way to detect the size change?

PS

Just added a query of ContentNote.ContentSize and that remains at the original value too.

  • Are you saying that even the newly created ContentVersion record still carries the size of the old version? – Charles T Jul 26 '18 at 12:21
  • @CharlesT Correct. I’m giving up trying to use the field. – Keith C Jul 26 '18 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.