0

I have a custom button in a salesforce page, and I want that when I click it, an apex method is executed. I follow the tutorial here but I get an error when I click it:

{faultcode:'soapenv:Client', faultstring:'No operation available for request {http://soap.sforce.com/schemas/package/DevisToFacture}createFacture, please check the WSDL for the service.', }

Here is the javascript I put when I created the custom button :

{!requireScript("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var result = sforce.apex.execute("QuoteToInvoice","createInvoice",{idQuote:"{!Quote.Id}"});
alert(result);
window.location.reload();

My apex class is named QuoteToInvoice (it is a public with sharing class), the method is named createInvoice and it has a parameter idQuote whose type is Id.

Do you have any idea of what I'm doing wrong ?

2

Your class must be global, global with sharing, or global without sharing, and the method must be webservice static. This is in the Apex in AJAX documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.