Loading

Files remain in AWS storage even after deletion from Salesforce org

Julkaisupäivä: Apr 22, 2026
Kuvaus

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.

Ratkaisu

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.

Knowledge-artikkelin numero

005318916

 
Ladataan
Salesforce Help | Article