Skip to content

A Node.js tool to extract, transform, and export Salesforce data to JSON. This lightweight ETL tool connects to Salesforce, retrieves object data, applies custom transformations, and outputs clean JSON files ready for use in other systems or workflows.

License

Notifications You must be signed in to change notification settings

ellisn19/salesforce-etl-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT

salesforce-etl-json

Extract, transform, and export Salesforce data to JSON using Node.js.

Overview

This is a simple ETL tool that connects to Salesforce, retrieves data from objects like Account, applies custom transformations, and outputs the results as JSON files. It’s designed to be lightweight and easy to extend.

Features

  • Extracts Salesforce records using SOQL
  • Transforms data with customizable mapping functions
  • Outputs JSON files for use in other systems or workflows

Setup

  1. Clone the repo:

    git clone https://github.com/<yourusername>/salesforce-etl-json.git
    cd salesforce-etl-json
  2. Install dependencies:

    npm install
  3. Configure your Salesforce credentials:

    Update the alias property in config/org.json to match your org's alias.

  4. Configure a query and field mapping in config/querries.json:

    {
    	"queryName": {
    		"query": "SELECT Id, Name, Phone, CreatedDate FROM Account LIMIT 100",
    		"fieldMap": {
    			"id": "Id",
    			"name": "Name",
    			"phone": "Phone",
    			"createdDate": "CreatedDate"
    		}
    	}
    }

Usage

Run the ETL process with:

npm start <queryName>

This will:

  • Execute the defined query in config/queries.json

  • Transform the returned records according to your mapping logic

  • Write the output to output/<queryName>.json

Project Structure

salesforce-etl-json/
├── output/           # JSON output files
├── config/           # Config
│ ├── org.json        # Org Config
│ ├── queries.json    # Queries Config
├── src/
│ ├── index.js        # Entry point
│ ├── etl.js          # ETL orchestration
│ ├── sfdxExtract.js  # Salesforce query logic
│ └── transform.js    # Data transformation functions
├── package.json
├── README.md
└── .gitignore

Extending

  • Support other output formats (CSV, databases, APIs)

License

MIT

Feel free to reach out if you want help adding features!

About

A Node.js tool to extract, transform, and export Salesforce data to JSON. This lightweight ETL tool connects to Salesforce, retrieves object data, applies custom transformations, and outputs clean JSON files ready for use in other systems or workflows.

Topics

Resources

License

Stars

Watchers

Forks