Handling Files in Salesforce

File storing strategy in Salesforce is a crucial component of effective data management and document handling within the platform. Salesforce is a powerful customer relationship management (CRM) system that enables organizations to store, manage, and access a wide range of files and documents, such as sales collateral, contracts, invoices, and customer communications. Developing a well-thought-out file storing strategy is essential to ensure data integrity, security, and accessibility for users across your organization.

The amount of file storage that is available in Salesforce varies depending on the org edition, but the Platform is not designed to store large volumes of files like an Enterprise Content Management (ECM) solution. This is why you typically want to integrate with dedicated storage solutions, such as Google Drive, Dropbox, Box, or AWS, when you deal with large numbers of documents.

?File storage limits in salesforce.

Storage is divided into two categories. File storage includes files in attachments, Files home, Salesforce CRM Content, Chatter files (including user photos), the Documents tab, the custom File field on Knowledge articles, and Site.com assets.Retrieve and store file in a repository in salesoforce, S@, v/s FTP

Additional storage space can be purchased from Salesforce in blocks of 50 or 500MB. That will run you??$125/month for 500MB of additional data storage. File Storage can also be purchased for $5/month for 1GB. Taking into account that this is not a one-time payment, data storage may actually cost more than your annual license.

?

Challenges and limitations when handling Files on Salesfprce

Files uploaded or attached through the Files related list are limited to 10 at a time in Lightning Experience. In Salesforce Classic,?you can attach more than 10 files simultaneously.

If you are using LWC to upload a file ,Only 6mb of File can be uploaded from Javascript (FromLWC) at once. Alternative options can be uploading one file at a time, or compress file using Java script library and upload it.

  • Salesforce storage and cost associated to it
  • Uploading multiple Files at once can be complicated. if file size is a lot consider asynchronous processing and multipart form data.
  • Apex transactions have a total heap space of up to 12 MB?.Files may exceed that limit

?File Storage Strategy can be finalized based on following factors

  • ·?????? Expected volume of files
  • ·?????? How often user wants to retrieve the Files
  • ·?????? Time for implementation,Cost and other resources
  • ·?????? Existing landscape.
  • ·?????? Reporting requirements, and other requirements
  • ·?????? File retention and Governance.

·Performance Optimization: Large file uploads can impact Salesforce performance. Monitor the performance of your Salesforce instance and consider implementing asynchronous processing for large file uploads to prevent timeouts or delays in other operations.

Error Handling: Develop a robust error handling strategy to deal with issues like failed uploads, file format mismatches, or exceeding storage limits. Provide clear error messages to users to help them troubleshoot problems.

File Formats allowed

Mobile considerations. File upload should work from which devices/

?Below are some approaches that can be considered for File Storage-

1.?????? Store Files in salesforce

2.?????? Files Connect

3.?????? Store files in Big Object

4.?????? Store Files in S3 bucket AWS

5.?????? Store Files in SFTP/Database/Filesystems.

6.?????? Use App exchange packages.

?

Store Files in salesforce

  • This approach should be used when Expected volume of files is minimal.
  • Files can also bestored in text area field.File can stored ?in compressed format using Javascript library
  • Images can also be stored in Rich text area fields. The images stored in a RTA field are saved to the ContentReference (not?ContentDocumentLink, ContentDocument, or ContentVersion) object.
  • The maximum size of an image that can be uploaded in a rich text area field is 1 MB. Only .gif, .jpg, and .png file types are supported.

Images within the rich text area fields count towards file storage for the object that contains the field.

  • As files are stored in salesforce retrieval is easy
  • If there are any chances of increase in File storage, archival strategies should considered.
  • Salesforce storage is expensive so,every organization should have file storing strategy.

?

Use Files Connect

Salesforce has a out of the box files connect functionality which is used to connect external file storage systems like sharepoint, Drop box, One drive and Google drive.

Files connect cannot be used with on premise storage options like on Premise Sharepoint.

?Files Connect can be used with Experience Cloud as well.

Planning should be done for authentication.

?Enterprises using file storage systems like sharepoint, Drop box, One drive and Google drive can use File Connect.

Single integration user can be used or per user integration can be used

Preview Files is possible with Google Drive, not with Sharepoint as external data source.

?Files Connect not very good option for scenarios where Sharing use cases are complicated. Example-Share file based on a criteria on opportunity.

?

Store files in Big Object

A big object?stores and manages massive amounts of data on the Salesforce platform. You can archive data from other objects or bring datasets from outside systems into a big object to get a full view of your customers.

Big object storage is calculated asynchronously, so new records aren’t immediately reflected.

?File Blob(in binary format), can be stored in Big object text area field.

?Big object data can be retrieved using SOQL or Async SOQL

?When should we use Big Object-:

  • 360° view of the customer—Extend your Salesforce data model to include detailed information from loyalty programs, feeds, clicks, billing and provisioning information, and more.
  • Auditing and tracking—Track and maintain a long-term view of Salesforce or product usage for analysis or compliance purposes.
  • Historical archive—Maintain access to historical data for analysis or compliance purposes while optimizing the performance of your core CRM or Lightning Platform applications.

?

?

?Store Files in Amazon S3

Amazon S3?is a popular web services from AWS for file storage. S3 offers an API-enabled content storage service in environments called “buckets.” S3 is durable, reliable, scalable, secure, and available across the world, and AWS provides?SDKs for multiple programming languages. Just like with Salesforce Functions.

Files can be offloaded to Amazon S3, using Salesforce functions or Rest API.Salesforce function does not have any governor limits.

?When we create a bucket in salesforce we need to create a bucket and choose a region where bucket will reside


Storage use cases for Amazon S3-

  • Backup and storage:?S3 is a natural place to back up files because it is highly redundant. As mentioned in the last unit, AWS stores your EBS snapshots in S3 to take advantage of its high availability.
  • Media hosting:?Because you can store unlimited objects, and each individual object can be up to 5 TBs, S3 is an ideal location to host video, photo, or music uploads.
  • Software delivery:?You can use S3 to host your software applications that customers can download.
  • Data lakes:?S3 is an optimal foundation for a data lake because of its virtually unlimited scalability. You can increase storage from gigabytes to petabytes of content, paying only for what you use.
  • Static websites:?You can configure your bucket to host a static website of HTML, CSS, and client-side scripts.
  • Cat photos:?Because of the limitless scaling, the support for large files, and the fact that you access any object over the web at any time, S3 is the perfect place to store cat photos.

?

Store Files in Database/Filesystems.

It's better to store images & videos in plain files rather than in a DB. This way you will minimize the CPU usage and the number of iops on uploading/downloading images and videos and playing videos.

Keep two copies of each image or video file in separate datacenters.

Store the index of all the image or video files in your favorite SQL or NoSQL database. On uploading a new image or video file first try to upload it into two separate servers and then if these operations are succeeded update the index. On playing a video file or downloading an image just get the next chunk of a file from a first available server out of a pair.

?

?

Some important links-:

https://developer.salesforce.com/blogs/2022/06/reduce-file-storage-consumption-with-salesforce-functions-and-amazon-s3

https://help.salesforce.com/s/articleView?id=000386920&type=1

Amrik Das

13x Certified Salesforce Architect | Driving CRM Innovation and Transformation | Encouraging Mentor | Talk to me about Agentforce

1 年

Very insightful Sakshi! Didn't expect 'Cat photos' to come in during the article ?? Well written! ??

Priyankar Pakhira

Salesforce Solution Architect | Salesforce Consultant | Salesforce Learner | 21X Salesforce Certified professional

1 年

SF Functions is the great option to upload files to S3 bucket from SF but Salesforce is retiring Salesforce Functions from January 2025.

要查看或添加评论,请登录

Sakshi Nagpal的更多文章

  • How AI has transformed our lives-How does ChatGPT works.

    How AI has transformed our lives-How does ChatGPT works.

    Transforming the Future: The Impact of AI on Our Everyday Lives Artificial Intelligence (AI) has indeed become a…

  • Capture Image with LWC

    Capture Image with LWC

    Yes, you heard it right, we can capture image using LWC.This feature can be used by reps on the field to capture Images…

    2 条评论
  • What is the Maurity of your Rest API

    What is the Maurity of your Rest API

    if you are looking for a way to evaluate your Rest API, Richardson Maturity Model can help you in understanding the…

    1 条评论

社区洞察

其他会员也浏览了