Ajax

Salesforce

Calling Apex method from a Custom Button

To call Apex method from Custom Button, follow the below steps 1. Create a custom button and enter the following code Syntax: {!REQUIRESCRIPT("/soap/ajax/12.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/12.0/apex.js")} sforce.apex.execute("Class_Name","Method_Name",{parameter_Name:"value"}); location.reload(true); Code: {!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")} var ....