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 ?

0

1 Answer 1

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.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.