Adaptal

Data Storage Check and File Deletion

Best Practice

File Storage shrunk | Adaptal
Overview

We are a Salesforce Consulting Partner who is passionate to help our clients fully enjoy and leverage Salesforce’s capabilities. We understand that data storage and management is a vital aspect which is of many businesses’ concern.

Each Salesforce org has its internal storage space for both data and files (images, documents etc.). Files can take up a lot of storage space in Salesforce. This article will:

  • Show how to check data storage usage (including file storage).
  • Introduce what Files (Content Documents) are and how to delete them.

Check Data Storage

To get an idea of how much storage your Salesforce org has and its usage, go to “Storage Usage” in Setup:

Data Storage and File Deletion,

A lot of times, files (images, documents, videos etc.) can take up sizeable storage space. If storage usage is approaching its limit, you can consider deleting some old / archived files.

 

Delete Files (Content Document):

Files are controlled by three objects: Content DocumentContent Version and Content Document Link:

  • Content Document, the parent object of both Content Version and Content Document Link, represents an individual file in Salesforce. Deleting it will also delete the child object records.
  • Content Version records represent all the versions of that file, past and present.
  • Content Document Link represents the link to entities (i.e. objects) the file is shared with.

To delete files, we need the Record ID of Content Document records:

  1. Normally, Users (including Admins) only see the Content Document owned by themselves.
  2. To see all Content Document records, create a new Permission Set.
  3. Under App Permission, check the “Query All Files” checkbox.
  4. Assign the Permission Set to the User.

After assigning the Permission:

  1. You can now see all Content Document record Id when you query them with Salesforce Inspector (ContentDocument).
  2. You can also filter the queried data by Content Size and Created Date to select the file records you want to delete.
Conclusion

Deletion of Files can free up much storage space in your Salesforce org. However, it is important to review the files that you want to delete. Moreover, it is recommended that important data (together with Files) should be exported as backup before mass data cleaning.

Alternatively, you can purchase more storage space if necessary.