npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sfdm

v1.0.4

Published

This command line tool will help you move data across Salesforce Orgs with support to data with External Id relationship and Record Type. It will save you the hassle work of spreadsheet VLOOKUP and stuff.

Downloads

5

Readme

Salesforce Data Migration CLI

This command line tool will help you move data across Salesforce Orgs with support to data with External Id relationship and Record Type. It will save you the hassle work of spreadsheet VLOOKUP and stuff.

Getting Started

Prerequisites

Latest version of Node.js and npm. Please visit https://nodejs.org/en/

Installing

npm install sfdm -g

Then, you can run sfdm --help to check if it is installed successfully.

Usage


sfdm --help
Usage: sfdm [options] [command]

  Options:

    -u, --username <username>                Salesforce Username
    -p, --password <password>                Salesforce Password and Security Token
    -q, --query [query]                      SOQL Query to perform export
    -o, --object [object]                    SObject that is going to be imported or exported
    -f, --filePath [filePath]                File path of the input for importing
    -e, --externalIdField [externalIdField]  The External Id Field for the import
    -l, --loginUrl [loginUrl]                Salesforce Login Url
    -s, --saveAs [saveAs]                    The path to save the export result
    -h, --help                               output usage information


  Commands:

    export   Perform SOQL query to export data from Salesforce
    import   Import data from exported file to Salesforce

Export

The SOQL query will be queried using Bulk API to retrieved data as JSON file. This data can be used in the next step of data migration which is import.

Example:

sfdm export -u [email protected] -p password -o Account -q "SELECT Name FROM Account LIMIT 10" -l https://login.salesforce.com -s ./Account.json

The result will be saved as Account.json in the current working directory.

Import

The specified JSON file will be imported to the Salesforce org in the manner of upsert using Bulk API. If you do not wish to use upsert or simply want to do a whole insert, then specify the externalIdField as Id.

Example:

sfdm import -u [email protected] -p password -o Account -f ./Account.json -e Account_External_Id__c -l https://test.salesforce.com

Data with Relationship

External Id

The relationship with other object with External Id can be imported using sfdm. For example, there is a Passenger__c Custom Object which related to Flight__c Custom Object through FlightId__c Custom Field. Fortunately, Flight__c has an External Id Field which is named Flight_External_Id__c. For the import to automatically related Passenger__c and Flight__c automatically. The External Id field must be retrieved as FlightId__r.Flight_External_Id__c. For example,

sfdm export -u [email protected] -p password -o Passenger__c -q "SELECT Name, FlightId__r.Flight_External_Id__c FROM Passenger__c LIMIT 10" -l https://login.salesforce.com -s ./Passenger__c.json

Please pay attention to the FlightId__r.Flight_External_Id__c, this is where the relationship is specified and Salesforce will handle the relationship accordingly.

Record Type

Record Type assignment can be done in a single import unlike the traditional Data Loader way with VLOOKUP. sfdm will query for all of the Record Type before the import and they will be assigned accordingly. The prerequisite is for the JSON file to be retrieved with RecordType.DeveloperName field. For example,

sfdm export -u [email protected] -p password -o Passenger__c -q "SELECT Name, RecordType.DeveloperName FROM Passenger__c LIMIT 10" -l https://login.salesforce.com -s ./Passenger__c.json

Relationship without External Id

This is not yet supported.

Acknowledgments

This project heavily relying on the use of jsforce. Please send love.

Donate

Bitcoin: 12kwTkrhx2zmUpdrEfTKRqJm93xzckLgTu Litecoin: LKU1RFPXeK7GUh7QDcW7pYW43dYVwQyBqa Ethereum: 0xdF67ED920348B201404dcDb004A9Ce0E93dD3443