diff --git a/package.json b/package.json index e5e8ba7..414fae8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/soql.js b/soql.js index 839d9bc..6963300 100644 --- a/soql.js +++ b/soql.js @@ -6,6 +6,7 @@ module.exports = function(RED) { RED.nodes.createNode(this,config); this.connection = RED.nodes.getNode(config.connection); var node = this; + var query = ''; this.on('input', function(msg) { // show initial status of progress @@ -13,7 +14,9 @@ module.exports = function(RED) { // use msg query if node's query is blank if (msg.hasOwnProperty("query") && config.query === '') { - config.query = msg.query; + query = msg.query; + } else { + query = config.query; } // create connection object @@ -27,7 +30,7 @@ module.exports = function(RED) { // auth and run query org.authenticate({ username: this.connection.username, password: this.connection.password }).then(function(){ - return org.query({ query: config.query }) + return org.query({ query: query }) }).then(function(results) { msg.payload = { size: results.totalSize, diff --git a/sosl.js b/sosl.js index 309a6f3..be12127 100644 --- a/sosl.js +++ b/sosl.js @@ -6,6 +6,7 @@ module.exports = function(RED) { RED.nodes.createNode(this,config); this.connection = RED.nodes.getNode(config.connection); var node = this; + var query = ''; this.on('input', function(msg) { // show initial status of progress @@ -13,7 +14,9 @@ module.exports = function(RED) { // use msg query if node's query is blank if (msg.hasOwnProperty("query") && config.query === '') { - config.query = msg.query; + query = msg.query; + } else { + query = config.query; } // create connection object @@ -27,7 +30,7 @@ module.exports = function(RED) { // auth and run query org.authenticate({ username: this.connection.username, password: this.connection.password }).then(function(){ - return org.search({ search: config.query }) + return org.search({ search: query }) }).then(function(results) { msg.payload = { size: results.length,