JSforce that can run easily the SalesforceAPI from JavaScript. It is very convenient to try using Visualforce page of Developer environment.
Download the jsforce jibrary and create in static resource with name jsforce
https://cdnjs.cloudflare.com/ajax/libs/jsforce/1.5.0/jsforce.js
Download the jsforce jibrary and create in static resource with name jsforce
https://cdnjs.cloudflare.com/ajax/libs/jsforce/1.5.0/jsforce.js
<apex:page> <apex:includeScript value="{!$Resource.jsforce}" /> <apex:form> <apex:commandButton value="Get Count" onclick="return doClick();" /> </apex:form> <script> var conn = new jsforce.Connection({accessToken: '{!$Api.Session_Id}'}); function doClick () { var soqlQuery = 'SELECT Id, Name FROM Account'; conn.query (soqlQuery, function (err, res) { if (err) { alert (err); } alert (res.records.length); }); return false; } </script> </apex:page>
Hi Suresh,
ReplyDeleteThanks for your post.
I would like to know, what are the core difference b/w jsForce and Ajax API.
When we choose individually?
Thanks