You need to sign in to do that
Don't have an account?
Vimal Bhavsar 6
How to Call Webserivce on Custom button on Account Page
Hi,
I want to add one custom button on Account Create page and on that button i want to call one webservice by which i can add that account information data in to external database/SQL database.
please advice for the same thnx
I want to add one custom button on Account Create page and on that button i want to call one webservice by which i can add that account information data in to external database/SQL database.
please advice for the same thnx
You have to add a Custom button with Java Script .
and use this code
in this method First parameter is the Name of class which have Webservice method
And second one is the Name of webservice Method
and if this method have some parameter then write on the last one .
Cheers
First create a webservice apex class as global as shown below
global class MyClass2 {
webservice static String processDetails(String accID){
return 'test';
}
}
now create a button as you like with behaviour as "Execute javascript" and content source with "on click javascript".
then write your javascript code as shown below
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
try{
var accId='{!Account.Id}'
var result = sforce.apex.execute("MyClass2", "processDetails",{accId : accId});
}
catch(err) {
alert(err);
}
sforce.apex.execute() method is used to call webservice methods.
let us know if it helped