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
sivassivas 

sforce.apex.execute problem

I am calling a web service on click of a button through java script. I am passing a string parameter to the constructor. 'a' is of type String. Also output is of type List. How to capture that? Should i have to define an array?

 

gCamp -- Callout Class

gCamp -- Constructor

 

sforce.apex.execute("gCamp","gCamp",{a:AccountId});

 

 

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

var accId="{!Account.Id}";

var a;

sforce.apex.execute("gCampaignInfo","gCampaignInfo",{a:accId});

 But i am getting the following error:

 

A problem with onclick java script or button was encountered:

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

 

Any Ideas. Thanks.

 

Siva

 

 

Imran MohammedImran Mohammed

You are trying to invoke the constructor . That will not work.

Only methods defined as Webservice methods in the global class are allowed to be invoked using sforce.apex.execute.

 

Try to rename the gCampaignInfo and declare it as webservice method.

Then invoke that method.

If you need any help let me know