Inspired by Christine Miller who asked on Success Community if there existed a solution that let users mass assign multiple files to multiple records, and not thinking that any such solution existed, I developed one.


The solution is available on GitHub and can be deployed with a click-of-a-button to your sandbox or developer org.

The core of this solution is a Lightning Component that lets users select or upload Chatter Files to share to records selected from a List View. The power comes from this component being able to be launched from List View button thereby putting users in control of how to find one or more records to add one or more files to in a single operation. For convenience, this solution comes with pre-configured List View buttons for Account, Contact, Lead, Opportunity, and Case objects. All you have to do is add the buttons to the Search Layouts. It’s also easy to support more objects, the instructions are documented in the README on the GitHub repo.

Although this uses a Lightning Component, this solution is supported in both Classic and Lightning Experience by leveraging Lightning Out for Visualforce.


Once deployed in your org (always test first in sandbox) then you use it as simply as you do a List View.

Start by selecting one or more records from a list view that you want to mass add files to.


Then select one or more files. You can filter by recently viewed, search by filename, or upload a file on the spot.


Lastly, click the Attach Files button in top-right. For each selected record their Files related list will now show the selected files shared to them. Behind the scenes, the code simply inserts a bunch of ContentDocumentLink records. If a selected file has already been shared with a record then that’s fine, the code is smart enough to only create new shares.


Supporting File Uploads

Some of my developer friends (perhaps Cory Cowgill or Peter Knolle) reading this will be suspicious about the upload feature and wondering about Apex Heap Limits (6MB). You’ll be happy to know that feature uses Chatter REST API to support large files thanks to Pat Patterson and the ForceTK library!