Associate your new file to more than just the Case. This post is part of the Uploading and Working with Files in Flow mini series.
Ingredients:
- Install/setup flow package
- Flow: E01_005_RelateAFileToMultipleRecords
- Standard File Upload flow screen component (included in the flow)
- Case object – need at least one case record in your org with a related Contact
Video Tutorial (1.5 min)

What’s Happening in the Flow:
- This flow is just like the “Rename an Uploaded File” sample flow, but in the loop we aren’t touching ContentDocument at all.
- “Create Content Doc Link” query: In the loop, instead of updating a record, we’re creating one: a ContentDocumentLink.
- In this sample flow, we want the File to not only show up when looking at the Case, but also when you view the related Contact. We don’t need to upload it twice and suck up valuable file storage – we just need to create another association (a ContentDocumentLink) between the existing ContentDocument and the Contact.
- The setting of values:
- ContentDocumentId: this is available from the current looped item
- LinkedEntityId: this is the Contact record Id, which we can get from the existing getCase query
- ShareType: we’ve set this to
I
(for Inferred), so that access to the file is based on access to the related Contact record (see documentation for other options). - Visibility: we’ve set this to
AllUsers
, although there are some other options in the documentation.
- That’s it! Once you’ve uploaded a file through this sample flow, go to the Contact record and see the same file in both the Case and Contact related lists. Or, even better, just go to the file detail page from one of these locations, and look at the “Shared With” related list to see all the ContentDocumentLinks for the same file.
Please review Some Limits for caveats related to this particular use case.