Deleting multiple files from Salesforce using Salesforce Inspector

Deleting multiple files from Salesforce

Issue

Customer salesforce org is getting full with the files and the store is at 130%. Will need to free up space from the org.

But when going to the files tab and deleting them, no option to delete them in bulk.

Solution

Before we dive into the developer console or any tools let’s do some basic setup required.

To be able to see all the files and delete them, user needs to have “Modify All Data” permission. So in this case I created a Permission set to assign this permission to the user and then followed the below steps.

  1. Used the query to get all the list of files in Salesforce inspector. If you have not used Salesforce Inspector before, it’s a great tool for admins and helps developers , admins and users. You can install it in your browser . Chrome or FireFox. Click the links to install them, if not already done so.
SELECT Id, CreatedDate, LastModifiedById, PublishStatus, FileType, ContentAssetId FROM ContentDocument where contentAssetid = null and (CreatedDate > 2021-07-01T00:00:03.409-04:00 and CreatedDate < 2021-07-30T00:35:03.409-04:00 ) order by createddate

2. Copy the result to get the ids

3. Used the Salesforce Inspector to Delete the records in a batch of 200 at a time (See the video).

Conclusion

There may be other ways to do this as well, but this is what helped me, so shared with all. Thanks for reading .. Follow or Subscribe if not already done. Till next post , Keep reading and sharing….


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *