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
ckellieckellie 

A problem with the OnClick JavaScript for this button or link

I am writing an apex button to invoke a class and am recieving the following error:

 

A problem with the OnClick JavaScript for this button or link was encountered:

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

 

The apex class and the javascript have the same class.

Button:

// Include and initialize the AJAX toolkit library
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/26.0/apex.js")};
var idList = {!GETRECORDIDS($ObjectType.QuoteLineItem)};
var retURL = window.location.toString();
var proceed = true;
if(idList.length == 0){
alert('Please select at least 1 record.');
proceed = false;
}
if(idList.length != 0){
var myvar = sforce.apex.execute("ProductDescription","SplitDescription",{QuotteLinetem_id:idList})
window.alert(myvar);

}

 Class un version 26.0

Global class ProductDescription {
    

    List<String> xarray = new List<String>();
    QuoteLineItem qli {get; set;}
    id idlist;
    
    public ProductDescription(ApexPages.StandardController c) {
        qli = [select id from Quotelineitem where id =: ApexPages.currentpage().getParameters().get('qli')];
        system.debug('###########qli:'+qli);
    }

   Public pageReference SplitDescription(){
   
   List<QuoteLineItem> cqli = [select id, pricebookentryid, PricebookEntry.Product2.Description
                                   from QuoteLineItem where id =:idList];

   For(Quotelineitem qli : cqli){
     xarray = qli.PricebookEntry.Product2.Description.split('\n');   
        system.debug(xarray);
   }
    Product_Description_Line__c[] split = new Product_Description_Line__c[0];
    For(String sa : xarray){
           split.add(New Product_Description_Line__c(quote__c = cqli[0].quoteid,
                    Quote_Line_Item__c = cqli[0].id,
                    Description_Line__c = sa
                    ));

   insert split;

  }
  return null;
  }
}

 What am I doing wrong and how do I solve the error?

 

Thank you

Best Answer chosen by Admin (Salesforce Developers) 
DharmeshDharmesh

Method  "SplitDescription" of class "ProductDescription" doesnt take any input argument and you are passing argument from your java script call

 

Please replace your call from {QuotteLinetem_id:idList} to {}

 

Also you can can try including "js" files for different version may be 15.0

 

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