Node-Salesforce is moved and renamed to JSforce (https://github.com/jsforce/jsforce).
stomita / node-salesforce Goto Github PK
View Code? Open in Web Editor NEWSalesforce API Connection Library for Node.js Applications
License: MIT License
Salesforce API Connection Library for Node.js Applications
License: MIT License
Node-Salesforce is moved and renamed to JSforce (https://github.com/jsforce/jsforce).
Is there a way to implement the bulk rest api in order to make CRUD operations in Bulk?
The refresh_token flow doesn't seem to be working. After the OAuth token expires, it just fails silently and even if I provide the refresh_token, it does not work.
Any ideas?
Idea?
$ sfjs
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object # has no method 'split'
at Interface.setPrompt (readline.js:121:24)
at new REPLServer (repl.js:128:7)
at Object.start (repl.js:251:14)
at Object.start (/usr/local/lib/node_modules/node-salesforce/lib/repl.js:88:35)
at Object. (/usr/local/lib/node_modules/node-salesforce/bin/sfjs:4:14)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
Getting the error:
gyp ERR! configure error
gyp ERR! stack Error: gyp
failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_module
s\npm\node_modules\node-gyp\lib\configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modu
les\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\YouConnected
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm http 304 https://registry.npmjs.org/websocket-driver
npm ERR! not ok code 0
on doing npm install. Node version is mentioned in the error.
Errors in callbacks are not thrown. Normally we expect errors in callbacks not be swallowed by Promise chain.
connection.sfobject('Account').create(account,function(err,result){
throw new Error('This error will be suppressed')
})
In addition, the Promise implementation breaks normal error handling expectations.
connection.sfobject('Account').create(account).then(function(){
throw new Error('This error will be suppressed as expected')
}).catch(function(e){
console.error('But this will never be seen.')
})
Using the .done function does work as expected.
connection.sfobject('Account').create(account).done(function(){
throw new Error('This error will be thrown as usual')
},function(sfError){
//handle error from salesforce
})
Hi there! Could not find a way to download a blob (Attachment file content) properly - request to URLs like
https://na14.salesforce.com/services/data/v24.0/sobjects/Attachment/00P58000000JqEKEA0/Body
it's executed without encoding:null in request. I use sObject.retrieve function to get body. I've fixed that locally inside the module, but I'm pretty sure that was wrong way to do - and you can fix it better :)
Getting this
MALFORMED_ID: Related To ID: id value of incorrect type: sforce_api_calls_sosl_find.htm#topic-title
First off, thanks for putting this library out there, it has been immensely useful!
I know this is supposed to be a wrapper around the REST API but unfortunately, I don't think the REST API supports all the functions that are available through the SOAP API. Would it be possible to support some of the Core functions like convertLead: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_convertlead.htm
thanks
-bhang
The various different flavours of using nextRecordsUrl for large queries seem to be broken, as they call the Query constructor with a null config parameter which barfs on "this.select(config.fields);"
I'm trying to find a work around. Any thoughts?
Hello,
I have installed node-salesforce, but when I try to load the package I get the following error:
> require('node-salesforce')
TypeError: Cannot read property 'async' of undefined
at /Users/raphael/nodejs-doctrine/node_modules/node-salesforce/node_modules/async/lib/async.js:8:30
at Object.<anonymous> (/Users/raphael/nodejs-doctrine/node_modules/node-salesforce/node_modules/async/lib/async.js:692:2)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/raphael/nodejs-doctrine/node_modules/node-salesforce/node_modules/async/index.js:3:18)
at Module._compile (module.js:409:26)
>
Hey, great work on the Salesforce-node.js integration. I am loving it. I am logging in the node.js site using standard login page with salesforce credentials. It returns the instance url and access token which is saved in my session.
However, in the docs, it is mentioned that we can only log out using session Id and server url. Can I not log out using the instance url and access token? I tried doing that but it threw an error.
Hi,
could you please extend the method Connection.prototype.authorize of the connection.js to provide after an authorize the User Id in the callback? It's stored in this parameter like for example:
"id":"https://login.salesforce.com/id/00Dd0000000dDhxEAF/005d0000000jI3AAAU"
case "EXISTS":
return [ field, value ? "=" : "!=", "null" ].join(" ");
This doesn't seem to work...
shouldn't it be something like:
return [ field, value ? "!=" : "==", "null" ].join(" ");
?
if value is true
(ie. $exists: true
) check against != null
otherwise check == null
?
Maybe I am not using it correctly, but I have for example:
AccountId: { $exists: true }
and it doesn't work when I would expect object to be returned. If I set it to false
it does work.
Hello, @stomita tanks for this library. I have the question: chat in sales forces can integrate in API for developing?
Can anyone advise how to add Chatter functionality?
I was trying to update/create a case but ownerid was overwritten by the auto assign rule.
I added Sforce-Auto-Assign to FALSE in the header and seems to resolve this issue.
connection.js
482 Connection.prototype.create = function(type, records, callback) {
483 if (arguments.length === 2) {
510 headers : {
511 "Content-Type" : "application/json",
512 'Sforce-Auto-Assign': 'FALSE'
513 }
}
Hi ,
I got this error when trying to install with npm 1.3.14 + node 0.10.22 + Win7 :
"...
1372 verbose false,C:\node\myapp\node_modules,C:\node\myapp\node_modules\node-salesforce\node_modules unbuild [email protected]
1373 info postuninstall [email protected]
1374 verbose about to build C:\node\myapp\node_modules\node-salesforce
1375 info C:\node\myapp\node_modules\node-salesforce unbuild
1376 info preuninstall [email protected]
1377 info uninstall [email protected]
1378 verbose true,C:\node\myapp\node_modules,C:\node\myapp\node_modules unbuild [email protected]
1379 verbose C:\node\myapp\node_modules.bin,[object Object] binRoot
1380 info postuninstall [email protected]
1381 error [email protected] install: node-gyp rebuild
1381 error Exit status 1
1382 error Failed at the [email protected] install script.
1382 error This is most likely a problem with the node-expat package,
1382 error not with npm itself.
1382 error Tell the author that this fails on your system:
1382 error node-gyp rebuild
1382 error You can get their info via:
1382 error npm owner ls node-expat
1382 error There is likely additional logging output above.
1383 error System Windows_NT 6.1.7601
1384 error command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "node-salesforce"
1385 error cwd C:\node\myapp
1386 error node -v v0.10.22
1387 error npm -v 1.3.14
1388 error code ELIFECYCLE
1389 verbose exit [ 1, true ]
"
TX.
Need some help in querying records with LookUp fields and Child objects. How should one write the column names in Method Chaining
This would be great if you could make a small enhancement to support custom build SOAP API Call. It's not about building the whole stuff by parsing the wsdl but rather this could be cool in a first step just to call a method like .genericSOAP to which we give the full SOAP request.
and then you build the http request, send the request, get the result and send it to a callback function. This would have also to support if the access token is still valid - and if not refreshing it. Actually this shouldn't be far away from the soap login / logout method you have already written, just more generic.
The point is that the REST API is cool but limited while the SOAP API is weird but offers lots of possibilities - and building ourself the request might be not that nice but it's still pretty easy.
Hello team,
With subsequent saleforce releases. The password seems to expire after every 3 months.
How can it be handled in the system?
Hello @stomita,
First, thanks for this Node.js package. I'd like to get the Description and Required value of a particular field. If I do as followed in the documentation:
conn.sobject('Account').describe(function(err, meta) {
if (err) { return console.error(err); }
console.log(meta.fields);
});
I noticed that each field describe doesn't contain the description
and required
keys (and also a couple other keys available there http://www.salesforce.com/us/developer/docs/api_meta/Content/customfield.htm).
Is there a way to get them using the package or something to fix in my request?
Thanks.
Is there any way or is there the possibility of adding the ability to use this module behind an authenticated proxy?
I am behind a corporate proxy and am having no joy in getting this to work. At home it works fine.
Thanks,
Sean
Hey, I invite you to update your NPM package. I think it contains some unwanted files that you may not want to share, like test.sh
, pipeline.sh
, migration.sh
and also y our project folder .sublime
. Some may contain sensible information.
I have been using node-salesforce to be the glue between our salesforce data and separate services. Problem I find is that after a while, a few hours, it seems like every request I attempt with SObject#find(conditions, fields)
just never returns.
I have put in code for this to detect if the query has persisted for too long and attempt retrying the query. This seems to work till it it simply "timesout" over and over and over again.
I'd like to say this is an error in the way I am using the API. I see that the build is currently "failing." Are there any flags I can switch on in the API that enables some verbose logs that could be useful to diagnose the potential issue?
Hi,
I am trying to deploy some custom object and fields from one organization into another. Is it possible to achieve this with this client?
Any ideas why it occured? Thanks.
[email protected] install /var/releases/20130823215226/node_modules/node-salesforce/node_modules/xml2json/node_modules/node-expat
node-gyp rebuild
make: Entering directory /var//releases/20130823215226/node_modules/node-salesforce/node_modules/xml2json/node_modules/node-expat/build' CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o make: cc: Command not found make: *** [Release/obj.target/expat/deps/libexpat/lib/xmlparse.o] Error 127 make: Leaving directory
/var/releases/20130823215226/node_modules/node-salesforce/node_modules/xml2json/node_modules/node-expat/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/packages/encap/node-v0.10.15/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 2.6.18-238.el5
gyp ERR! command "node" "/packages/encap/node-v0.10.15/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/releases/20130823215226/node_modules/node-salesforce/node_modules/xml2json/node_modules/node-expat
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
Hi all, I am attempting to refresh my accessToken using a refresh token, I've attempted to follow the docs but the connection is failing silently and the refresh event is never triggered. All of the parameters are valid as far as I can tell. Regular authentication seems to be working fine.
var oauthParams = {
clientId: 'xxx',
clientSecret: 'xxx',
redirectUri: 'xxx'
};
function refreshAuth(refreshToken, accessToken) {
var deferred = Q.defer();
// console.log('creating connection with:', oauthParams);
conn = new sf.Connection({
oauth2: oauthParams,
instanceUrl: 'https://na15.salesforce.com',
accessToken: accessToken,
refreshToken: refreshToken
});
conn.on('refresh', function(accessToken, res) {
console.log('refresh complete:', accessToken);
deferred.resolve(accessToken);
}, function(err) {
console.log('hidden err:', err);
});
return deferred.promise;
}
var body = { title: 'hello', num : 1 };
conn.apex.post("/MyTestApexRest/", body, function(res) {
// the response object structure depends on the definition of apex class
});
This code should be
var body = { title: 'hello', num : 1 };
conn.apex.post("/MyTestApexRest/", body, function(err, res) {
// the response object structure depends on the definition of apex class
});
Please update this on NPM page
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.