Templates / Sync Salesforce leads and opportunities to PostgreSQL with backfill and incremental ETL

Sync Salesforce leads and opportunities to PostgreSQL with backfill and incremental ETL

Ready for 3.0

by Muh Resky Adiansyah ✓ · 98 views · created 2026-04-12 · CRM

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 17 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects Salesforce and Postgres.

How it runs

Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).

  1. Set Historical Date Range (Edit Fields (Set)): sets or maps fields
  2. Set Incremental Dates (Code): runs custom JavaScript code
  3. Generate Weekly Periods (Code): runs custom JavaScript code
  4. Loop Over Date Periods (Loop Over Items (Split in Batches)): loops over the items in batches
  5. Fetch Lead Records (Salesforce): get many
  6. Fetch Opportunity Records (Salesforce): get many (opportunity)
  7. Phone empty? (Lead) (If): checks a condition and branches into true / false
  8. Phone empty? (Opportunity) (If): checks a condition and branches into true / false
  9. Merge: merges the data from its input branches
  10. Normalize Lead Phone (+62) (Edit Fields (Set)): sets 1 field: body.nomorlead

…plus 5 more steps. See the full node list below.

Services it uses

SalesforcePostgres

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (10)

From the author

Salesforce Leads & Opportunities to PostgreSQL (Backfill & Incremental Sync ETL) This workflow extracts Lead and Opportunity data from Salesforce, transforms and normalizes the data, and loads it into PostgreSQL as a structured data bank for reporting and…

Excerpt from Muh Resky Adiansyah's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.