- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2015 08:07 AM
Hi,
Can aynone help me out in identifying the error in the following code? My expectation is function should return value , but it is returning value
var IreturnInc = Class.create();
IreturnInc.prototype = Object.extendsObject(AbstractAjaxProcessor, {
IreturnInc : function()
{
var incref = new GlideRecord('incident');
incref.query();
if(incref.next())
return incref.number;
},
type: 'IreturnInc'
});
Please help.
Regards,
Anil Karamsetty
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2015 05:06 AM
Thanks All for your Coordination. Code is working now. but surprisingly i did not make any changes to the code , i copied the code from my post and pasted in demo instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2015 08:08 AM
My Client Side Script is
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('IreturnInc');
ga.addParam('sysparm_name','IreturnInc');
ga.getXML(HelloWorldParse);
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2015 08:14 AM
Hi Anil,
This is working fine for me. Can you please make sure that you marked the Client callable field with a check mark on the Script Include. Without this you will receive a null value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2015 09:49 AM
Hi Travis,
It was already enabled. May be their is something wrong with the code.
Regards,
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2015 10:07 AM
Hi Anil,
What instance version and browser version are you running? I have tried this in Fuji with Safari and Firefox without an issue and without any changes to code.
The two things that you can check in the mean time (I check for these an occasionally find issues):
1. Change the return in your script include to be return incurred.number + ''; This forces a string conversion which shouldn't be an issue but for some scripts it does cause problems.
2. Check in your browser console to make sure that responseXML is being returned as an object. You can do this by adding a console.log(response.responseXML); statement in your HelloWorldParse callback. Some browsers choke on this one for some reason.