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
SFDC LearningSFDC Learning 

Problem in custom button to call apex method

Here is my button code: 


{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
var result = sforce.apex.execute("SendAccountUsingRESTAPI","callgetContact",{IDD:"{! 
Account.Id}"});



APex class which i m calling: 

Global class SendAccountUsingRESTAPI {
  

  Global class deserializeResponse
   {
      public String id;
      public String access_token;
   } 
 
   webservice static void callgetContact(Id IDD)
   { }
}

When i am clicking on button it gives me an error: {faultcode:'soapenv:Client', faultstring:'No operation available for request {http://soap.sforce.com/schemas/package/SendAccountUsingRESTAPI }callgetContact, please check the WSDL for the service.', }"

Thank you in advance!
Best Answer chosen by SFDC Learning
Shun KosakaShun Kosaka
Hi,
I tried your button and apex in my DE org and it works well. Do you have a namespace in your org? If the namespace of the org is "abc", try the following:
var result = sforce.apex.execute("abc.SendAccountUsingRESTAPI","callgetContact",{IDD:"{! 
Account.Id}"});