Skip to content

Instantly share code, notes, and snippets.

@matt-newell
Last active February 16, 2022 17:41
Show Gist options
  • Save matt-newell/c78f5360712a41bb05a04c2a0e595557 to your computer and use it in GitHub Desktop.
Save matt-newell/c78f5360712a41bb05a04c2a0e595557 to your computer and use it in GitHub Desktop.

Test sfdc connection

#!/usr/bin/env node
const jsforce = require('jsforce');
function main(){
try {
var conn = new jsforce.Connection({
loginUrl : 'https://test.salesforce.com'
});
conn.login(process.env.username, process.env.password, function(err, userInfo) {
if (err) { return console.error(err); }
// Now you can get the access token and instance URL information.
// Save them to establish connection next time.
console.log(conn.accessToken);
console.log(conn.instanceUrl);
// logged in user property
console.log("User ID: " + userInfo.id);
console.log("Org ID: " + userInfo.organizationId);
// ...
});
} catch(ex){
console.log(ex)
}
}
console.log('bra')
main()
{
"name": "sfdc-connect",
"version": "1.0.0",
"description": "Bulk v2 > sfdc",
"main": "index.js",
"bin": {
"sfdc-connect": "./index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Matt Newell",
"license": "ISC",
"dependencies": {
"jsforce": "^1.11.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment