I am creating a JavaScript button that calls an apex class that returns a message string. I would like to show that string in a alert box when I press the button. Is there a way to do that?
This is what I have so far in my javascript button:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}
try{
sforce.apex.execute("Ctrl_JS_CallInformaDB","setCall",{"nif":'{!Account.NIF__c}',
"country":'{!Account.BillingAddress}'});
window.location.href="/{!Account.Id}";
function onControllerReturn( returnMessage ) {
alert(returnMessage);
}
}catch(err){
var txt = "Error: ";
txt+=err.description+" 11";
alert(txt);
}