on a particular object I have a button that executes JavaScript. Inside of the script I want to call an apex class and pass in the Id of the object I am viewing as a parameter to my apex method but my method takes Set.

My JavasScript Button code looks like below:


var parameter = "{!myObject.Id}";

var retVal = sforce.apex.execute( "className", "methodName", {contractIds: parameter});

My Apex Class starts off with:

public with sharing class className {
  public void methodName(Set<Id> contractIds) {

Currently when I press the button I get an error... "A problem with the OnClick JavaScript for this button or link was encountered: {faultcode:'soapenv:Client', faultstring:'No operation available for request...", how can I properly pass in my parameter? I would greatly appreciate any help!


2 Answers 2


API versions 30.0 and below have been deprecated. That's what the error message is telling you. Change the URL to include at least version 31.0.


I would recommend going up to a more modern version though, as these versions will remain active longer.


I think the problem is namespace is missing in your code.

Your Code

 retVal = sforce.apex.execute( "className", "methodName", {contractIds: parameter});

How it should be

str = sforce.apex.execute("namespace.AAAParser","parserMethod",{"obj":obj,"NXH":nxh}); 

also your code is that you are passing a single string value as the parameter for your Apex method , but your method expects a Set of Ids this can help

var idSet = new Set();


Also you can can try including "js" files for different version may be 15.0

{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}; {!REQUIRESCRIPT("/soap/ajax/31.0/apex.js")};

Also try setting your class to Global

Some helpful Links,


Problem with an OnClick JavaScript webservice

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .