JSForce | JavaScript Library of Salesforce API

I came across a neat and relatively well documented jscript library for Salesforce that works with Salesforce API. This library work on bo...

I came across a neat and relatively well documented jscript library for Salesforce that works with Salesforce API. This library work on both web-browser and Node.js.


Uniqueness of JSforce :

This javascript library is designed to support both server side and client side apps, meaning this will save time rewriting same logic with multiple libraries. Good side of this library is that JSForce supports


  • REST API (SOQLSOSLCRUDdescribe, etc.)
  • Apex REST
  • Analytics API
  • Bulk API
  • Chatter API
  • Metadata API
  • Streaming API
  • Tooling API

JSForce on Visualforce Page using Angular.JS and BootStrap

I designed a page, and that uses bootstrap and Angular.js CDN to make the page responsive and Angular to add powerful functionality, thanks to Taiki for sharing similar post


How to get started : 

The JSForce is very handy and self explanatory and best part is that there are tons of examples provided by developer and you can jump in directly to their github page to see them here.
To get started copy-paste this code but to move forward you will require static resource

Download - JSForce here or download minified version that I created here

Now disable developer mode, you can use 'Toggle It' extension I wrote to disable developer mode then open console and see the log and you fill find the records showing up as shown in picture


Using Angular.js and Bootstrap with JSForce 

Lets make our page more powerful and featureful. I have here added CDN source of Angular.js Javascript and Bootstrap3 on a new visualforce page that has search functionality and classes to beautifully represent the data we just pulled in a HTML table and also lets  make them responsive as well. See the page below after changes (you can copy-paste) code to run. 




To achieve the functionality I designed a method here in javascript that populate the $scope as shown in snippet up here

Now we populate the table content by looping through repeter 'ng-loop'. Here is the source code for full page - copy-paste in your organization to have a look. I am coming up with some of my experiments with Streaming API and Analytics and Chatter with JSForce sooner

Taking Page to Salesforce 1 

I took this page to Salesforce 1 as we had responsive design up here and search method and this turn out to be beautiful.

The only limitation as API call count, each page refresh or data pull using script will count against the API call. See the in action video here

What Others Are Reading