Salesforce to S3 file migration & cleanup
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...
Template notes
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).