You need to sign in to do that
Don't have an account?

I am getting a error at the calling time of apex class by using costom java script button .?
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
var r = confirm(" Are you sure to call the apex class ?");
if(r == true)
{
sforce.apex.execute("javasclass","check",{str:'Amit'});
alert("Sent it for class");
}
---------------------------------------------------
global class javasclass {
webservice static void check(string x){
system.debug('this is x '+x);
}
}
-----------------------------------------------
It gives a error :

{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
var r = confirm(" Are you sure to call the apex class ?");
if(r == true)
{
sforce.apex.execute("javasclass","check",{str:'Amit'});
alert("Sent it for class");
}
---------------------------------------------------
global class javasclass {
webservice static void check(string x){
system.debug('this is x '+x);
}
}
-----------------------------------------------
It gives a error :
You should use variable name 'x' not str. Try changing sforce.apex.execute("javasclass","check",{str:'Amit'}); to sforce.apex.execute("javasclass","check",{x:'Amit'}); this should work.
Regards,
Bhushan