You need to sign in to do that
Don't have an account?
Michael Hedrick 2
Faultcode on button calling webservice
I have a custom button calling a webservice but when slected I get this error:
Button:
Class
It was not throwing an error earlier so I am assuming it is due to the Class changes made. Any suggestions is appreciated.
M
{faultcode: 'soapenv:client', faultString: ' No Operation available for request {http://soap.sforce.com/schemas/package/CallTrexWebServiceInsideSales}TrexWebServiceInsideSales,please check the WSDL for the Service.' ,}Not sure if its the button or the Class:
Button:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} { var retStr; retStr = sforce.apex.execute("CallTrexWebServiceInsideSales", "TrexWebServiceInsideSales", {id:'{!Lead.Id}'}); }
Class
Global class CallTrexWebServiceInsideSales{ public static Lead leads {get;set;} public static String myresponse{get;set;} public static string TrexWebServiceInsideSales (String id) { TrexWebServiceInsideSalesAsync(id); return myresponse; } @future(Callout=true) webservice static void TrexWebServiceInsideSalesAsync(String id) { leads = [SELECT Email, FirstName , LastName , city FROM Lead WHERE id =:id]; if(String.isEmpty(leads.email)) { myresponse = 'This lead is either missing an email address or the Account Type field is NULL.' ; } else { HttpRequest req = new HttpRequest(); Http http = new Http(); req.setMethod('GET'); String ActivityType = 'Sales'; string Subject = 'Trexpro and Dealer Locations sent to Consumer '; String url = 'https://abc/def.asmx' + leads + ActivityType +Subject; req.setEndpoint(url); HTTPResponse resp = http.send(req); myresponse = resp.getBody(); } } }
It was not throwing an error earlier so I am assuming it is due to the Class changes made. Any suggestions is appreciated.
M
Add "webservice" to correct method as below and it should work.
If I remove
I would receive an error.
Above is the code that I tried.