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
SivarajanSivarajan 

Sforce.Apex.Execute is not working

Hi,

 

I just want to create a record in an object when i click button on the detail page.I have made the logic in an Apex class and calling the method by using javascript. Please see the following code

 

try
{
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
  
    var opportunityName ="{!Opportunity.Id}";
   alert("Hi");
   alert(opportunityName);
   sforce.apex.execute("QuoteToOrderConverterController","QuoteToOrderConverter", {a:opportunityName});
}
 catch(e)
{
alert("Error while converting from Quote to Order");
}

 

 

 

 

Here it 's showing Error as  {faultcode: 'soapenv:client', faultString: ' No Operation available for request {http://soap.sforce.com/schemas/package/QuoteToOrderConverterController}QuoteToOrderConverter,please checkthe WSDL for the Service.' ,}

 

Please assist.

 

Thanks in advance.

 

Best Answer chosen by Admin (Salesforce Developers) 
billkbillk

Solved my own problem, thanks to a post from (unsurprisingly...) SimonF:

 

The developer edition org I was working in has a namespace prefix defined.  So, I must add the namespace prefix plus a dot "." to the name of my class, e.g.:

 

 

var result = sforce.apex.execute("DEMO_PREFIX.DemoWidgets","MarkCompleted", {ActionID: "foo" });

 where "DEMO_PREFIX" is the developer prefix for my org.

 

Now its working like a charm!

 

 

All Answers

shillyershillyer

Try later versions of the script:

 

<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>

 

Hope that helps,

Sati

billkbillk

I'm encountering the same problem in OnClick Javascript behind a custom link, using the design pattern from the "Force.com Cookbook"

 

Apex class:

 

global class DemoWidgets {

Webservice static String MarkCompleted(String ActionID){

return ActionID;

}
}

 

 Text of OnClick Javascript:

 

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

var result = sforce.apex.execute("DemoWidgets","MarkCompleted", {ActionID: "foo" });

alert(result);

 

 Result when run on the client:

 

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/DemoWidgets}MarkCompleted, please check the WSDL for the service.', }

 

 

Message Edited by billk on 02-09-2010 08:55 AM
billkbillk

Solved my own problem, thanks to a post from (unsurprisingly...) SimonF:

 

The developer edition org I was working in has a namespace prefix defined.  So, I must add the namespace prefix plus a dot "." to the name of my class, e.g.:

 

 

var result = sforce.apex.execute("DEMO_PREFIX.DemoWidgets","MarkCompleted", {ActionID: "foo" });

 where "DEMO_PREFIX" is the developer prefix for my org.

 

Now its working like a charm!

 

 

This was selected as the best answer
Kyle RobertsKyle Roberts

I'm experiencing a similar issue but the problem is coming from connection.js itself. I'm attempting to make an sforce.apex.execute call however an exception is being thrown in connection.js when it tries to create the XMLHTTP object.

 

Breaks on line 575, 578 and 580 of connection.js (v18)

 

I've only confirmed the exception "ActiveXObject is not defined" through firefox and chrome. It does not work in IE 8 either.

 

Any ideas? 

 

Thanks

surya_CCIsurya_CCI

Thanks for the post.Its working now

RPReddyRPReddy

hi siva,

i have a same requirement like ability to convert a quote to order.i am very new to salesforce,is there any sample code you have regarding this requirement.if you have please share with me siva.

 

Thanking in advance.

 

Regards,

praveen