Salesforce CRM typically contains rich structured information about your customers and partners. It becomes even more valuable if you have the ability to attach semi-structured and unstructured information in the form of files. Salesforce Files allows you to do this and make the documents available at the right place inside Salesforce to provide a rich user experience.
There are different ways in which one can store and share files in Salesforce. The approach depends on the type of sharing and access mechanism needed for your business use case.
Store Own Files or Share with Specific Users
You can use the Files Home to upload specific files to Salesforce. Uploaded files are private and you can share with specific users. System admins or users with “View All Data” or “Modify All Data” permission can still see private files.
Library Shared with Specific Users
Creating libraries and storing the files in library folders gives you control to organize the content as per need. These libraries can be shared with specific people or Public Groups with varying access levels (Viewer, Author, Admin). One or more such libraries can also be shared with external users through an Experience Cloud site. The Libraries component in the builder allows you to display accessible libraries to external users in the Experience Cloud site too.
Attaching Files to Records
This is one of the most common approaches to using Files in Salesforce. A Files related list on a record allows you to attach one or more files to a record such as an Account, Opportunity, Contact or any custom object. Typically, anyone with access to the record can then view the files on the record in Salesforce. Files can also be made private on records using the File Privacy on Records setting.
One limitation of storing files on a record is that you can’t organize those in folders. Many times there are just too many documents categorized into different themes like contracts, invoices and sales decks. To create folders for files on a record, you can use an Appexchange app such as Folderize or create a custom component using LWC. More on such a custom component later in this article.
Sharing Files in Groups
Chatter groups are a great way to organize your internal/external users into a group to share group specific information and files. Groups are an excellent way to bring together users for a specific objective. You can create groups with partners and share files with specific users within the partner community.
Files Connect
Files Connect allows Salesforce users to access, share, and search external data from systems like Quip, Google Drive, SharePoint, or Box. In this approach, the files are either copied over into Salesforce or just referenced stored in external storage while they are accessible from Salesforce
CMS Collections on Experience Cloud
Another way of sharing information with external users is through Salesforce CMS. Salesforce CMS is a hybrid content management system (CMS) where you can create, edit, organize, and manage digital content from a centralized location. You can create content such as Document, Image, News (or custom content type) and extend the content to a channel such as an experience cloud partner portal. You can use the CMS Collection component on the experience cloud builder to add a collection of content in different layouts such as a carousel, Grid, Strip or Slideshow.
Content Delivery
Content Delivery allows you to share files securely for easy online viewing. This method can be used to share files with external entities such as leads, customers, partners or other company colleagues. With content delivery, you can create a unique link for a file which will expire after the configured date. You can also secure the delivery by adding a password. Once a content delivery is created, you can track how often people view or download the content. Content deliveries are available in Salesforce Classic only.
Custom Component
A custom component Lightning Web Component can be used to design a user interface as per your need to view/upload. It is important to note the relationship between various Content Objects. Some of the key objects include:
When creating a custom LWC component to upload a file, you can use the file-upload component from the Salesforce Component Library. If the record-id is not specified then the uploaded file is uploaded under Files Home using the uploading user’s id by default. If the uploaded file needs to be moved to some custom location after upload then you will need to handle the ‘uploadfinished’ event, which is fired when the upload is finished, to return a list of the uploaded files, including each file’s name and documentId. You can then move the uploaded ContentDocument to a desired folder by querying and updating the ContentFolderMember with appropriate parent folder id. ContentFolder object contains records of all folders, including a record for the library itself (ContentWorkspace id). In case, the file needs to be moved to the root library folder then you will need to use that record’s id in parent folder id. You can then use the insert/update events to the above objects to send any custom notifications.
The following table lists the methods for sharing files and when to use each method
Method | When to Use |
Store Own Files or Share with Specific Users | When confidential files need to be shared with only specific users irrespective of the Account/Opportunity record access.Files stored here can be thought of as information that is private or not yet ready to be shared with a wider audience. |
Library Shared with Specific Users | When a restricted set of users need to be given access to the content of the library. e.g. a separate library for different internal departments as well as for each of your key partners. |
Attaching Files to Records | When collaborating right on the record in SalesforceThis approach is typically used to store all relevant files pertaining to a record on the record itselfOne limitation of storing files on a record is that you can’t organize those in folders. |
Sharing Files in Groups | When sharing with internal users on a specific objective. E.g. within Chatter groups of a project, department etc.Also very useful in sharing files with external users through a group made up of external usersA Group page with Files list on the experience cloud site can be used to share files with the users. |
Files Connect | When your company is using external file storage serviceUtilize existing file storage services right inside Salesforce |
CMS Collections on Experience Cloud | When showcasing content in an organized manner on an experience cloud site.The content can be built using image files, articles etc. While this is not exactly Salesforce Files content, it’s a useful way of sharing information with the experience cloud users. |
Content Delivery | When you want to generate a link to share file externally through emailWhen you want to track the # of downloads on a file shared externally |
Salesforce provides various ways of securing files:
Limits around file size and file sharing
Refer to the relevant Limits imposed by the Salesforce Platform around file size and file sharing
Some examples of the limits include:
Salesforce provides significantly higher file storage allocations compared to data storage and so it makes sense to keep the important files in Salesforce for easy reference. The various ways in which you can safely and securely share these files with both Salesforce and external users, makes it a very powerful feature.
Team Varasi