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
Kevin Kim 9Kevin Kim 9 

{faultcode:'soapenv:Client; faultstring:'No such parameter id defined for operation. please check the WSDL for the service.'}

I've created a button with this java script:
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 
sforce.apex.execute("buttonHandler","copyOLItoPP",{id:"{!Opportunity.Id}"}); 
location.reload();

but I keep getting this error whenever I try to click it:
{faultcode:'soapenv:Client; faultstring:'No such parameter id defined for operation. please check the WSDL for the service.'}
Best Answer chosen by Kevin Kim 9
Vivian Charlie 1208Vivian Charlie 1208

Kevin,

 

Following is the updated button code

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
var strRecId = "{!Opportunity.Id}"; 
alert('********'+strRecId); 
sforce.apex.execute("buttonHandler","copyOLItoPP",{strRecId:strRecId}); 
window.location.reload();
 

In case your issue has been resolved please feel free to mark this as closed.

 

Thanks

Vivian

All Answers

Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi kevin, 

I hope by creating this button you want to call a Webservice from that javascript. If so, then there should be a Class called buttonHandler with a method like this,
 
global Class buttonHandler{
    WebService static <return_type>copyOLItoPP(String id) {
        // return whatever you like
    }  
}

If there are no class (with the Webservice ) in the org like this, you may get this error.

For reference, you can check out this, https://prosenjit-sarkar-sfdc.blogspot.in/2015/01/how-to-call-apex-method-through-custom.html (https://prosenjit-sarkar-sfdc.blogspot.in/2015/01/how-to-call-apex-method-through-custom.html" target="_blank

Thanks, 
Prosenjit
Kevin Kim 9Kevin Kim 9
Prosenjit, 

I made a class and it looks something like this: 
 
global class buttonHandler{ 
     Webservice static void copyOLItoPP(String strRecId){
    list<ProjectProduct__c> lstPP = new list<ProjectProduct__c>();
    List<OpportunityLineItem> lstOLI = [Select Quantity from OpportunityLineItem where OpportunityId =: strRecId];
    if(lstOLI != null && !lstOLI.isEmpty()){
      Project__c objProject = new Project__c();
      // map mandatory fields
      insert objProject;
      
      for(OpportunityLineItem objQ : lstOLI){
        ProjectProduct__c objProd = new ProjectProduct__c();
        // mapp all fields
        objProd.ProjectLookup__c = objProject.Id;
        lstPP.add(objProd);
      }
      if(!lstPP.isEmpty()){
        insert lstPP;
      }
    }
  }
}

I am still getting the same error.
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi kevin, 

Please use this code , 
 
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 
sforce.apex.execute("buttonHandler","copyOLItoPP",{strRecId:"{!Opportunity.Id}"}); 
location.reload();

you have to put the same parameter name to call the webservice. Sorry for late reply. Please let me know if you get any error. Please make this answer as best answer if it solve your problem.

Thanks,
Prosenjit.
Vivian Charlie 1208Vivian Charlie 1208

Kevin,

 

Following is the updated button code

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")} 
var strRecId = "{!Opportunity.Id}"; 
alert('********'+strRecId); 
sforce.apex.execute("buttonHandler","copyOLItoPP",{strRecId:strRecId}); 
window.location.reload();
 

In case your issue has been resolved please feel free to mark this as closed.

 

Thanks

Vivian

This was selected as the best answer
Dhairya Shah 31Dhairya Shah 31
Hello,
Having error "Please check WSDL for this service"!

Here is my OnClick JavaScript Code:
{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}

var r = confirm("Do you want to create new Contact?");
var fname = "{!Contact.FirstName}";
var lname = "{!Contact.LastName}";

if(r == true)
{
    var a = sforce.apex.execute("ContactPlan","createContactPlan",{fname : "{!Contact.FirstName}",lname : "{!Contact.LastName}"});
    alert(a);
}
else
{
    alert('Operation aborted');
}



Here is my APEX Code:
global class ContactPlan
{
    webservice String area;
    webservice String region;
    
    global class Plan
    {
        webservice String fname;
        webservice String lname;
        
    }
    webservice Static Plan createContactPlan(Plan vPlan)
    {
        Contact con  = new Contact();
        con.FirstName = vPlan.fname;
        con.LastName = vPlan.lname;
        insert con;
    
        return vPlan;
     }   

}

Can anyone help it out!???
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Dhairya,

Please createa new question or thread for this issues as this is a separate issue. you can put here the link of the new thread so that someone/me can follow it. 

Thanks
Prosenjit