function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TerminusbotTerminusbot 

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:
 
{!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) {  ...... }

 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
Try to create an array and push record id like this
var mySet = [];
mySet.push("{!Policy__c.Id}");
alert(mySet);
ChickenOrBeefChickenOrBeef
Hey Terminusbot, did you ever find a solution for this issue? I'm running into the same issue.

Thanks,
Greg