+ Start a Discussion

Java Script for custom buttons in salesforce




Where can I find "/soap/ajax/24.0/connection.js", "/soap/ajax/20.0/apex.js" these files in salesforce?

What is the purpose of using these files?

Ankit AroraAnkit Arora

If I've uploaded a javascript file in static resource and want to use it on visualforce page then we use


tag, right? So these files are exactly the same :-)



Ankit Arora

Blog | Facebook | Blog Page

Shivanath DevnarayananShivanath Devnarayanan



These are Javascript Wrappers around the Force.com API, which allow you to make Calls to your apex code, enable you for javascript remoting etc.


learn more about Apex in AJAX go here and to learn about the AJAX toolkit go here


and to answer the second part of your question, these javascripts are built in and cannot be modified, but you can view them by typing it directly in your browser


Connection.js : https://ap1.salesforce.com/soap/ajax/25.0/connection.js

Apex.js : https://ap1.salesforce.com/soap/ajax/25.0/apex.js


replace the ap1 instance with your server instance.


hope it helps !


/* Please mark it answered if it helped you, so that it may help someone else */



Hi Srinu,

   These are the AJAX toolkit includes built-in support for invoking Apex through anonymous blocks or public webService methods.


For example:

           If you want to call the Apex class by button click in the standard page layout, we can use these functions:

apex class:


global class myClass

  webService static Id makeContact(String lastName, Account a)


    Contact c = new Contact(LastName = lastName, AccountId = a.Id);
    return c.id;





 Create the button with the behaviour of Execute Javascript. and add the following:





**I hope this will helpful for you**