Templates / Sales / Salesforce Daily Sync to Amazon S3
Salesforce Daily Sync to Amazon S3
This workflow uses a scheduled trigger, which fires the workflow daily and copies any new or updated files from Salesforce, and stores them in AWS S3.
The following connectors are used in this template. This is provided for reference only - although you may need to consult the Salesforce and S3 docs for authentication instructions:
The image below shows a synced file in S3 and Salesloft :
This workflow assumes the following:
- You have API credentials set up with Salesforce and AWS S3.
In order to configure this workflow for use:
The overall logic of the workflow is:
- The workflow is triggered by a scheduled trigger that runs daily.
- Based on the Last Run Date, the workflow gets the file versions from Salesforce.
- Loops through the received file versions, downloads the Salesforce files and uploads it to the S3 bucket.
- In the end, it sets the Last Run Date, which will be used as a reference for the next run.
'Last Run Date' and 'Remove 7 Days'
The output from the Remove 7 Days step will only be used the first time this workflow runs.
On the first run, there will be no last run date in data storage, so we need to set a date in recent history to make the first check.
The Remove 7 Days step uses the Date time helpers Minus from date operation. It takes the workflow's execution start time ($.env.execution_start_time) and removes seven days from it.
If you wish to change how far back the first check goes, you can highlight the Remove 7 Days step, and in the properties panel to the right, change the number of 'Days' based on your requirements.
After the first run, the workflow will keep track of its previous run in the Set Last Run Date step and use this value every time the workflow runs henceforth.
Get File Versions
This step using Salesforce Find records operation gets the Content Version of the files.
The output for this step includes a list of files and their details that have been newly created or updated since the last run.
To ensure this, Salesforce uses a condition to check where the
LastModifiedDate should be Greater than the Last Run Date (
These files are later one by one downloaded from Salesforce and uploaded to S3.