Loading

Files remain in AWS storage even after deletion from Salesforce org

Дата публикации: Apr 22, 2026
Описание

Customers may observe that after deleting a file from Salesforce, the file is no longer visible in the UI but still exists in the underlying AWS storage.

This occurs because Salesforce removes only the reference to the file within the application, while the actual file stored in the external AWS S3 system is not automatically deleted.

This behavior aligns with how external storage integrations function, where Salesforce does not directly manage or delete files from customer-owned storage systems.

Решение

Since the files remain in AWS storage, customers can implement a custom cleanup process if required.

A common approach is:

  • Build a process to identify files that are no longer referenced in Salesforce
  • Use the stored external file reference (for example, the S3 key)
  • Perform a deletion operation directly in AWS (S3) for those unreferenced files

This can be achieved through custom flow logic such as -

  • Create a Record-Triggered Flow on the ContentDocument object
  • Trigger the flow when a file is deleted
  • Retrieve the associated ContentVersion record
  • Extract the ExternalDocumentInfo2 field from the ContentVersion record (which contains the S3 object key)
  • Use this key to invoke a DELETE callout to AWS (via Named Credentials or API integration) to remove the file from S3

This approach ensures that files are cleaned up from AWS in alignment with deletions in Salesforce.

Дополнительные ресурсы

Set Up the Salesforce Connection to Amazon S3

Номер статьи базы знаний

005318916

 
Загрузка
Salesforce Help | Article