As Salesforce Files of Archived Activities are not displaying in Lightning, our Sales manager is asked to try an option. That is to move the Files attached to Task/Events to its associated Opportunity or Account after a year or certain time period. I was thinking if we can update the Parent ID of Content Document to ID of Oppr/Acc. But am facing some issues trying that. So is that even possible? Any ideas?


You need to insert a contentDocumentLink record. As files can be connected to multiple records, you can simply insert this and the file will be connected to both. This assumes you are using file and not attachment.

  • Thats great, it did worked!! But in the Content Document object, ParentID is blank so we really can't find it's associated Opportunity/Account's ID. Is there a way to find it's Parent ID? – Amulya Aug 26 '19 at 19:58
  • ParentId is the library, per the docs. Since a file can be connected to N records there is no one parent. On contentVersion there is a field for firstPublishedLocationId. And on contentDocument there is latestPublishedVersionId. So those two fields may be helpful for you in finding the original parent. – gorav Aug 27 '19 at 11:43
  • firstPublishedLocationId is not populated on all records and not holding the Parent ID am looking for. But thank you very much for all your suggestions. – Amulya Aug 27 '19 at 14:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.