You need to sign in to do that
Don't have an account?
Custom Button: Call Apex Class with JavaScript from Buttom {Error}
I created a button on a custom object: Policy__c.
I want the button to fire and call an Apex Class. The method of the class I am calling takes a Set called ids.
Here is my JavaScript:
The error I am recieving when button is selected is the following:
It is showing the records Id as the variable that it can't find. Any help would be appreciated.
Just for refrence here is the class and method I am trying to call.
I want the button to fire and call an Apex Class. The method of the class I am calling takes a Set called ids.
Here is my JavaScript:
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} var mySet = new Set(); mySet.add({!Policy__c.Id}); var result = sforce.apex.execute("ClientDelta","sendQuery",{ids: mySet}); alert(result); window.location.reload();
The error I am recieving when button is selected is the following:
A problem with the OnClick JavaScript for this button or link was encountered: Can't find variable: a0019000002vmyy
It is showing the records Id as the variable that it can't find. Any help would be appreciated.
Just for refrence here is the class and method I am trying to call.
global class ClientDelta { @future (callout=true) @RemoteAction global static void sendQuery(Set<ID> ids) { ...... }
var mySet = [];
mySet.push("{!Policy__c.Id}");
alert(mySet);
Thanks,
Greg