+ Start a Discussion
Patrick FordPatrick Ford 

How to re-parent FILES (not attachments) from case to related contact?

So I'm beginning to understand ContentDocument and ContentDocumentLink SOQL queries... I think what I want to do is make new ContentDocumentLinks between my ContentDocuments... so that the LinkedEntityId is the Contact instead of the Case... but struggling with how to implement this as ContentDocumentLinks cannot be edited...

Here's my SOQL for looking up the files owned by a particular user as a test case.
SELECT Title, OwnerId, Id, FileExtension
FROM ContentDocument
WHERE OwnerId = '0051Q00000Ef3t3QAB'

and files associated with a single case:
SELECT ContentDocument.title, ContentDocument.ownerId, Id, ContentDocument.FileExtension
FROM ContentDocumentLink
WHERE LinkedEntityId = '5001Q00000pJCv1QAG'

but i'm unclear where to from here!