Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ npm install node-red-contrib-salesforce

## Usage

Each node uses a connection object to hold and share Salesforce connected app settings (consumer key, consumer secret, username, etc.). This determines the org that each node operates against.
<p>Each node uses a connection object to hold and share Salesforce connected app settings (consumer key, consumer secret, username, etc.). This determines the org that each node operates against.</p>
<p>The credential fields can be left blank and passed in the message (msg.sf), this allows you to store them outside of the flow so that they will not be exposed when exporting it.</p>

### SOQL

Expand Down
16 changes: 8 additions & 8 deletions connection-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
category: 'config',
defaults: {
name: {value:'', required: true},
consumerKey: {required: true},
consumerSecret: {required: true},
consumerKey: {value:''},
consumerSecret: {value:''},
callbackUrl: {required: true},
environment: {value: 'production', required: true},
username: {required: true},
password: {required: true},
username: {value:''},
password: {value:''},
},
label: function() {
return this.name || this.username + ' connection';
Expand Down Expand Up @@ -50,11 +50,11 @@
</div>
<div class="form-row" style="white-space:nowrap">
<label for="node-config-input-consumerKey"><i class="fa fa-key"></i> Consumer Key</label>
<input type="text" id="node-config-input-consumerKey">
<input type="text" id="node-config-input-consumerKey" placeholder="msg.sf.consumerKey">
</div>
<div class="form-row" style="white-space:nowrap">
<label for="node-config-input-consumerSecret"><i class="fa fa-user-secret"></i> Consumer Secret</label>
<input type="password" id="node-config-input-consumerSecret">
<input type="password" id="node-config-input-consumerSecret" placeholder="msg.sf.consumerSecret">
</div>
<div class="form-row" style="white-space:nowrap">
<label for="node-config-input-callbackUrl"><i class="fa fa-history"></i> Callback URL</label>
Expand All @@ -69,10 +69,10 @@
</div>
<div class="form-row">
<label for="node-config-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-config-input-username">
<input type="text" id="node-config-input-username" placeholder="msg.sf.username">
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-config-input-password">
<input type="password" id="node-config-input-password" placeholder="msg.sf.password">
</div>
</script>
16 changes: 16 additions & 0 deletions dml.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ module.exports = function(RED) {
config.object = msg.object;
}

// get credentials from msg.sf if present and config values are blank
if (msg.hasOwnProperty("sf")) {
if (msg.sf.consumerKey && this.connection.consumerKey === '') {
this.connection.consumerKey = msg.sf.consumerKey;
}
if (msg.sf.consumerSecret && this.connection.consumerSecret === '') {
this.connection.consumerSecret = msg.sf.consumerSecret;
}
if (msg.sf.username && this.connection.username === '') {
this.connection.username = msg.sf.username;
}
if (msg.sf.password && this.connection.password === '') {
this.connection.password = msg.sf.password;
}
}

// create connection object
var org = nforce.createConnection({
clientId: this.connection.consumerKey,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-salesforce",
"version": "0.0.5",
"version": "0.0.6",
"description": "A set of Node-RED nodes to interact with Salesforce and Force.com.",
"author": {
"name": "Jeff Douglas",
Expand Down
16 changes: 16 additions & 0 deletions soql.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ module.exports = function(RED) {
config.query = msg.query;
}

// get credentials from msg.sf if present and config values are blank
if (msg.hasOwnProperty("sf")) {
if (msg.sf.consumerKey && this.connection.consumerKey === '') {
this.connection.consumerKey = msg.sf.consumerKey;
}
if (msg.sf.consumerSecret && this.connection.consumerSecret === '') {
this.connection.consumerSecret = msg.sf.consumerSecret;
}
if (msg.sf.username && this.connection.username === '') {
this.connection.username = msg.sf.username;
}
if (msg.sf.password && this.connection.password === '') {
this.connection.password = msg.sf.password;
}
}

// create connection object
var org = nforce.createConnection({
clientId: this.connection.consumerKey,
Expand Down
16 changes: 16 additions & 0 deletions sosl.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ module.exports = function(RED) {
config.query = msg.query;
}

// get credentials from msg.sf if present and config values are blank
if (msg.hasOwnProperty("sf")) {
if (msg.sf.consumerKey && this.connection.consumerKey === '') {
this.connection.consumerKey = msg.sf.consumerKey;
}
if (msg.sf.consumerSecret && this.connection.consumerSecret === '') {
this.connection.consumerSecret = msg.sf.consumerSecret;
}
if (msg.sf.username && this.connection.username === '') {
this.connection.username = msg.sf.username;
}
if (msg.sf.password && this.connection.password === '') {
this.connection.password = msg.sf.password;
}
}

// create connection object
var org = nforce.createConnection({
clientId: this.connection.consumerKey,
Expand Down
16 changes: 16 additions & 0 deletions streaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ module.exports = function(RED) {
this.connection = RED.nodes.getNode(config.connection);
var node = this;

// get credentials from msg.sf if present and config values are blank
if (msg.hasOwnProperty("sf")) {
if (msg.sf.consumerKey && this.connection.consumerKey === '') {
this.connection.consumerKey = msg.sf.consumerKey;
}
if (msg.sf.consumerSecret && this.connection.consumerSecret === '') {
this.connection.consumerSecret = msg.sf.consumerSecret;
}
if (msg.sf.username && this.connection.username === '') {
this.connection.username = msg.sf.username;
}
if (msg.sf.password && this.connection.password === '') {
this.connection.password = msg.sf.password;
}
}

// create connection object
var org = nforce.createConnection({
clientId: this.connection.consumerKey,
Expand Down