GlideAjax error - Client Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 04:04 AM
Hi All,
I am trying to display current date and time as alert message on form load using onload client script and script include, but getting below error message in logs.
Script: u_u_person not found in scope: global, and HTTP Processor class not found: com.glide.processors.xmlhttp.u_u_person: no thrown error.
below are my script include and onload client scripts.
********Script Include**********
var TodaysDate = Class.create();
TodaysDate.prototype = Object.extendsObject(AbstractAjaxProcessor, {
todayDate: function ()
{
return gs.nowDateTime(); },
type: 'TodaysDate'
});
***********Onload Client Script*******
function onLoad() {
//Type appropriate comment here, and begin script below
var ajax = new GlideAjax('u_u_person');
ajax.addParam('sysparm_name', 'TodaysDate');
ajax.getXML(function (){
var date = ajax.getAnswer();
alert(date);
});
}
anyone can explain me where did i made mistake.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 04:16 AM
Hi Anil.
I hope your script include name is u_u_person since the client script has the same while creating GlideAjax object.
Thanks
Gaurav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 04:23 AM
Is your u_u_person in global scope and is the persmission allowed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 05:14 AM
If the script include is in a scope, and the catalog item is global, you need two things
- Check that the script include is available to all scopes (it's in the upper right of the form)
- address your script include with the scope name prefix. E.g. javascript:new myscope.myScriptInclude().myFunction()
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 06:18 AM
Thank you All.
i tried with below client script and its working for me.
in Previous code i gave table name instead of script include name.
function onLoad() {
//Type appropriate comment here, and begin script below
var ajax = new GlideAjax('TodaysDate');
ajax.addParam('sysparm_name', 'todayDate');
ajax.getXMLAnswer(function (answer){
var date = answer;
alert(date);
});