0

Case is not Accepting from Accept case Detail page button(javascript button).

Error Message :

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/acceptCaseCont} changeOwner,please check the wsdl for the service.',}

I have a button on case detail page "Accept Case" its a Detail Page Button. Behavior is Execute JavaScript and onClick JavaScript is

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

var cObj = new sforce.SObject("Case"); 
cObj.id = '{!Case.Id}'; 
var id = sforce.apex.execute("acceptCaseCont","changeOwner", 
{caseIn: cObj}); 
location.reload();

Class Code

global class acceptCaseCont{   
    webService static Id changeOwner(Case caseIn) {
        Case cs = [select id, OwnerId from Case where Id = :caseIn.Id];
        cs.OwnerId = UserInfo.getUserId();
        update cs;
        return cs.id;
    }
}

Screenshot

9
  • 1
    It should be easier by just passing the case Id as a String parameter. Jun 6, 2017 at 12:55
  • Otherwise, If your org is under a namespace, include namespace in execute call. I would also check if user is having appropriate permission for class or to update Case record.
    – Raul
    Jun 6, 2017 at 12:58
  • @MartinLezer I tried and pass case id but it's not working same error message showing. Jun 6, 2017 at 13:08
  • @RahulSharma user have already read write permission Jun 6, 2017 at 13:08
  • On Salesforce, when you read the apex class file, you have a "Security" tab. Did you check that the user profile is listed as Enabled profiles? Jun 6, 2017 at 13:17

1 Answer 1

0

Namespace added and code will work.

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

       var cObj = new sforce.SObject("Case"); 
       cObj.id = '{!Case.Id}'; 
       var id = sforce.apex.execute("DreamSalesforce.acceptCaseCont","changeOwner", 
      {caseIn: cObj}); 
        location.reload();

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .