You need to sign in to do that
Don't have an account?
Problem with Onclick JavaScript 'No operation available for request...'
Hi,
Please help!
I’ve created a veeeeery simple APEX class:
public class test { public boolean testMethod(){ return true; } }
The testMethod needs to be called when I press a button (custom button) with JavaScript Behaviour:
{!requireScript("/js/functions.js")}
{!requireScript("/soap/ajax/13.0/connection.js")}
{!requireScript("/soap/ajax/13.0/apex.js")}
var answer = confirm("Are you sure you want get Open Positions for this epic?")
if (answer){
alert(sforce.apex.execute("test","test", {}));
} else {}
But I have got the following error:
No operation available for request
{http://soap.sforce.com/schemas/class/test}testMethod.
All Answers
setup->create-apps
select your custom managed app.
This will display the "Namespace Prefix".
The problem is that your method is called "testMethod" but you're calling method "test". Try this:
alert(sforce.apex.execute("test","testMethod", {}));
yes sorry, I am using testMethod, it was an error I committed when I posted the code here.
I went to Setup --> Create-Apps to see the details of my app and it doesn't have a "Namespace Prefix" label.
I am wondering if there might be something wrong with the import of my libraries? Could it be that the version of the libraries is not the correct one? But which one should I be using?
Thanks for you help
Please check the access modifier for the class and method.
It should be something like this:
Note that you are not creating any instance of the class, so the method should be static.
How do I know what my name space is?