Salesforce to S3 File Migration & Cleanup Automate archiving old Salesforce files to Amazon S3, log them back in Salesforce, and free up org storage β all from a scheduled n8n workflow. --- π§ How It Works (High-Level) 1. Schedule Trigger kicks off (e.g., daily). 2. Query Salesforce for ContentDocument records older than 365 days. 3. Loop Each File β download binary via REST. 4. Upload to S3 with the original filename. 5. Lookup Links (ContentDocumentLink) to keep the parent record reference.

Salesforce to S3 File Migration & Cleanup Automate archiving old Salesforce files to Amazon S3, log them back in Salesforce, and free up org storage β all from a scheduled n8n workflow. --- π§ How It Works (High-Level) 1. Schedule Trigger kicks off (e.g., daily). 2. Query Salesforce for ContentDocument records older than 365 days. 3. Loop Each File β download binary via REST. 4. Upload to S3 with the original filename. 5. Lookup Links (ContentDocumentLink) to keep the parent record reference. 6. Filter Out Users (ignore LinkedEntityId starting with 005). 7. Create S3Filec record in Salesforce for traceability. 8. Delete Original File from Salesforce to reclaim storage. 9. Notify via Slack when the batch is done. --- π Set Up Steps (Time: 45β90 mins) 1. Import n8n Workflow JSON and wire up credentials (Salesforce OAuth2, AWS S3, Slack). 2. Install Salesforce Unmanaged Package (Custom Object S3Filec, Apex controller, LWC, settings). 3. Fill S3Settingsc (bucket, region, keys, expiry) or swap to Named Credentials. 4. Test with a Sandbox Batch (e.g., small date range) and verify upload/delete. 5. Schedule & Monitor (tweak interval, Slack channel). --- π Why youβll love it - πΈ Slash storage costs β offload gigabytes to S3 - π Full traceability β every file still tracked in Salesforce - π§° Plug & play β import JSON, install package, plug in creds - π§± Modular & extensible β swap S3, add approvals, build an uploader UI - β± Set it & forget it β scheduled automation + Slack alerts π¦ Whatβs Included - n8n JSON Flow β ready to import. - Salesforce Unmanaged Package β Apex (S3FilesController.cls), LWC (s3FilesViewer), S3Filec, S3Settingsc. - S3 + Salesforce Setup Guide β quick reference for configuring keys, permissions, and the LWC. All components are editable β extend, replace, or integrate with your own processes. --- π§± Requirements - n8n instance (self-hosted or Cloud) with HTTP Request, AWS S3, Slack, and Salesforce nodes. - Salesforce org with API access & permission to install unmanaged packages. - You have to have Query All Files permission. Setup-> Permission Sets / Profile -> App Permission -> Content -> Query All Files. Allows View All Data users to SOQL query all files in the org. - AWS S3 bucket + IAM user/role with GetObject/PutObject (and optional ListBucket).
Download the workflow JSON file after purchase.
Open n8n β click the menu β Import from File.
Select the downloaded JSON and import.
Set up credentials for each node that requires them.
Click Execute Workflow to test, then activate.
Setup guide included
Purchase to unlock the full step-by-step guide
No reviews yet
Be the first to buy and share your experience.
Leave a review
Sign in to share your experience with this workflow.
Create a free account to purchase workflows.
Need help setting this up?
Book a 3-hour live setup session with an Agility consultant.