Artisan IMG > Salesforce (salesforce) (dd966f42-81e8-4770-a3d8-d095ca41ab45)
Artisan IMG > AWS S3 (aws-s3) (c579c5ba-f479-4188-a0ff-21351036740c)

Sync Salesforce files to AWS S3 backups

Workflow
Sales
Intermediate

This is a 'Workflow' template which means that it is a single standalone workflow.

Some workflow templates can be modified to work with other workflow templates - e.g. to convert a data sync between two services from uni-directional to bi-directional

Overview
Copy

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.

Connectors Used
Copy

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:

End Result
Copy

The image below shows a synced file in S3 and Salesforce :

Prerequisites
Copy

This workflow assumes the following:

  • You have API credentials set up with Salesforce and AWS S3.

Getting Live
Copy

In order to configure this workflow for use:

Workflow Logic
Copy

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.

Implementation notes
Copy

'Last Run Date' and 'Remove 7 Days'
Copy

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
Copy

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 ($.steps.storage-1.value).

These files are later one by one downloaded from Salesforce and uploaded to S3.

Step-by-step Explanation
Copy