Use Ajax Toolkit for Salesforce in Developer Console

by - 1:20 AM

Browser like Safari, Chrome and Firefox now provides developer console to play around with javascript code that user want to perform over page. For newbies out here, I would like to explain in few words that the developers console is an jscript editor and compiler to compile run and test jscript code in live browser

Salesforce AJAX Tool kit on your safari/chrome/firefox console


Salesforce offer AJAX tool kit to run javascript and allowing user to make a connection with Salesforce and query salesforce from javascript, the data in-return can be handled in own fashion to be displayed on the page

To demonstrate here, I am using Safari as browser-agent called (WEB_INSPECTOR) to start the fun with jscript, just follow the steps below

1. Login to Salesforce 
2. Right click on pto open web-inspector
3. Copy the code below to begin the fun





Press enter to run the code



On successful execution, alert() will show this popup, which mean we are ready to shoot !


Query Salesforce from Console 

Go to AJAX tool API Guide now, to pick a sample code and run the query on salesforce from console, I am querying 10 users from the salesforce sandbox instance using the code below 


Here is how results looks like 


Google Chrome Issue : AJAX Toolkit from Console is not supported 

While using Google Chrome Console with stable version of chrome browser (32.0) in my case, I encounter this error

 Refused to set unsafe header "User-Agent"

I google for this issue here but still unable to resolve the error after clearing cache and restaring browser













I am writing my next post sooner, I using this toolkit to develop a chrome extension and that opens up new dimension of writing custom apps for the Google Chrome Extension and this can be used in multiple fashion.

Stay tuned for more fun and happy coding 

You May Also Like

0 comments