+ Start a Discussion

Need code to delete chatter file uploads



My goal is to keep only the most recent version of a chatter file.  When someone uploads a new version I want the old version to be deleted.  As far as I can tell this is not an option in salesforce.com.


My thoughts are creating a trigger on either a ContentDocument or ContentVersion that deletes the related ContentDocument or previous ContentVersion before the new version is uploaded, that way only one version will exist.  How can I accomplish this?




- Mike



It's my understanding that old versions of Content can't be "pruned". I'd love to be wrong on this, as this is one of my biggest gripes about Content.