You need to sign in to do that
Don't have an account?
Running WebService Function
Hi ALL,
I've a Apex Webservice Class as below
global class getQuotationNumber {
WebService static String QuoteNumber(String id) {
// My Codes Here
}
}
and I've use the following code in my VF page to call the functions....
It works well so far........however, after I add a namespace to my package........
I cannot callout the functions
Can Anyone answer my question.
The following is my code in the VF page
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/11.1/connection.js"></script>
<script src="/soap/ajax/10.0/apex.js"></script>
<script>
window.onload = function() {
sforce.connection.sessionId = '{!$Api.Session_ID}';
var id = '{!$CurrentPage.parameters.id}';
try {
var complete = sforce.apex.execute('getQuotationNumber', 'QuoteNumber', {id:id});
}
catch (e) {
alert(e.Name + ", " + e.Message);
}
alert(complete);
}
</script>
You need to specify the namespace explicitly
e.g.
var complete = sforce.apex.execute('namespace.getQuotationNumber', 'QuoteNumber', {id:id});
However, since you are doing this in VF, you should probably use the actionFunction tag rather than the ajax toolkit.