Step 1 : Lets first create the Apex class
Things to Remember:
- Class needs to be a Global class
- and the method you intend to call from the javascript must be a WebService Method
e.g.
Global Class RG_LeadConversionCls {
webservice static void LeadConvert(Id Leadid)
{
}
Step 2 : Now to setup the custom Button.
- Goto --> Setup --> Object --> Buttons, links and Actions section
- Click New Button or Link
- Enter the Name of the button
- Behaviour : Execute Javascript
- Content source : On-Click Javascript
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
sforce.apex.execute("RG_LeadConversionCls","LeadConvertId",{Leadid:"{!Lead.Id}"});
0 comments:
Post a Comment