sf-vlookup
v0.0.9
Published
This cli is to do the vlookup between two files after extracting the data from Salesforce and load the updated file to Salesfoce instance automatically.
Downloads
23
Maintainers
Readme
Salesforce vlookup and data load
This CLI is a useful utility to do the vlookup between two files after extracting the data from Salesforce and load the new updated file to the Salesforce instance automatically (can be by-passed) using Bulk API 2.0 to update the data of the primary object. The result will be stored in the output folder with the salesforce instance-id folder. The output folder will typically contain 7 files which comprise of:
- Data defined as per the SOQL query:
- Primary Object file
- Secondary Object file
- Comparision files:
- With matching result
- Without matching result
- Data Load files:
- Failed Result
- Successful Result
- Unprocessed Result
Note: the primary object is the one that will be changed/updated using the second object data.
Install
$ npm install sf-vlookup -g
How Do You Use It
To get help:
$ sf-vlookup --help
$ sf-vlookup -h
Login to already authentacted Salesforce instance:
$ sf-vlookup -u sf_instance_alias -pq "SELECT Id, Name FROM Account" -sq "SELECT Id, Email, LastName FROM Contact" -fm Name:Name,CustomField_Primary__c:CustomField_Secondary__c -c "CustomField_Primary__c:CustomField_Secondary__c"
Login to Salesforce production:
$ sf-vlookup -p -pq "SELECT Id, Name FROM Account" -sq "SELECT Id, Email, LastName FROM Contact" -fm Name:Name,CustomField_Primary__c:CustomField_Secondary__c -c "CustomField_Primary__c:CustomField_Secondary__c"
Login to Salesforce sandbox instance:
$ sf-vlookup -pq "SELECT Id, Name FROM Account" -sq "SELECT Id, Email, LastName FROM Contact" -fm Name:Name,CustomField_Primary__c:CustomField_Secondary__c -c "CustomField_Primary__c:CustomField_Secondary__c"
By-pass DML operation:
$ sf-vlookup -b -pq "SELECT Id, Name FROM Account" -sq "SELECT Id, Email, LastName FROM Contact" -fm Name:Name,CustomField_Primary__c:CustomField_Secondary__c -c "CustomField_Primary__c:CustomField_Secondary__c"
Options
Options:
-V, --version version number
-p, --production production
-b, --bypass-dml by-pass DML operation
-u, --user-name salesforce instance user name or alias, if already defined, the Salesforce instance
-pq, --primary-query (Required) Query of primary object
-sq, --secondary-query (Required) Query of secondary object
-fm, --comparable-field-map (Required) Comma-separated list of fields API name of primary to secondary object to compare the data files. This is used to find the records with an exact match. We can add as many comparison attributes as we need from both CSV files. Like:
Name:Name,CustomField_Primary__c:CustomField_Secondary__c
-c, --copy-field-value (Required) Field API name to be transformed and updated. Like:
CustomField_Primary__c:CustomField_Secondary__c
-h, --help display help for command
Prerequisite
To use sf-vlookup
CLI sfdx should be installed, here is the information to install sfdx
npm install sfdx-cli --global