Sync Snowflake data to Salesforce in bulk

Recipe ToolsDatabaseMarketingCRMProductivitySales EnablementDeveloper Tool

What it does

When someone calls this function, this automation runs custom SQL in Snowflake to prepare a staging table. It searches Salesforce for records to update and sends an email notification when the bulk operation completes.

Who it's for

Data and analytics teams who need to sync Snowflake data into Salesforce on a regular schedule.

How teams use this

Sync customer data nightly

Call this function on a schedule to move updated customer records from Snowflake into Salesforce each night. The team wakes up to fresh data without manual work.

Run the sync from a webhook

Invoke this function from an external system or API call instead of a schedule so the sync happens whenever upstream data changes. The steps remain the same.

Add error handling and retry logic

Include a condition to check if the Snowflake query fails, and set up a retry step before sending the email. Only notify the team if the sync completes or fails after retries.

How it works

  1. Receive the function call. A function call starts this automation in real time so Snowflake data can be prepared and sent to Salesforce.
  2. Prepare the staging table. Run custom SQL in Snowflake to truncate and load the staging table with the latest records from the source table.
  3. Search and bulk update records. Search Salesforce using a SOQL query to find records that match the staging data, then create or update them in bulk.
  4. Send a completion email. Send an email via Gmail with the number of records processed so the team knows the sync finished.