What is the purpose of connection.js(is it an external javascript file or anything) Please help me.

2 Answers 2


Connection.js and Apex.js are part of AJAX Toolkit. The first portion of any JavaScript code that uses the AJAX Toolkit must make the toolkit available to the JavaScript code. The syntax for this is different depending on whether you are embedding JavaScript in a Visualforce page, or a button or link.

After this script executes, the toolkit is loaded and a global object, sforce.connection, is created. This object contains all of the API calls and AJAX Toolkit methods, and manages the session ID. No other session management is needed.

Salesforce checks the IP address from which the client application is logging in, and blocks logins from unknown IP addresses.

For Visualforce pages or any source other than a custom onclick JavaScript button, specify a tag that points to the toolkit file: view sourceprint?


          <script src="../../soap/ajax/42.0/connection.js" type="text/javascript"></script>







For a custom onclick JavaScript button, use !requireScript to point to the toolkit file:


Connecting to the API


Connection.js is part of the Ajax toolkit for use with the SOAP API

You can find more information HERE on this where it is laid out pretty clearly

And you can refer to HERE for information about the AJAX Toolkit and its usage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .