- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 09:00 PM
Hi All,
I have written an onLoad() Catalog Client Script where I used GlideAjax which is calling a script include.
Script Include has the simple glide record query where it fetches a date time field value based on the query result.
When I execute the script via background script, its returning the date time field value correctly.
But returning null value during onload() of the record producer.
What I am doing wrong in this?
Any help is much appreciated.
Thanks,
Ram Prakash K R
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2020 03:27 AM
Hi All,
Finally the below setting worked:
var test = task.getDisplayValue(fieldBackEndName);
Thanks all for your prompt replies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 10:45 PM
Hi Ankur,
Below are the Script Include and onLoad() Scripts:
Script Include Script:
var scriptIncludeName = Class.create();
scriptIncludeName.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
myFunction: function() {
var task = new GlideRecord("tableName");
task.addQuery("requested_for.sys_id=",this.getParameter('sysparm_user_name'));
task.query();
if(task.next()) {
gs.log("Inside Script Include");
var test = task.fieldName.getDisplayValue();
return test;
}
},
type: 'scriptIncludeName'
});
onLoad() Catalog Client Script:
function onLoad() {
//Type appropriate comment here, and begin script below
var userID = g_user.userID;
alert("Logged In User ID:" + userID);
var ga = new GlideAjax('scriptIncludeName');
ga.addParam('sysparm_name', 'myFunction');
ga.addParam('sysparm_user_name', userID);
ga.getXML(HelloWorldParse);
}
function HelloWorldParse(response) {
alert("Success");
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
g_form.setValue("variableBackEndName", answer);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 10:50 PM
try
var test = task.getDisplayValue("fieldNameOfWhichYouWantData");
also are you getting that log in system logs?
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 10:53 PM
Hi,
It didn't work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 10:54 PM
also
task.addQuery("requested_for",this.getParameter('sysparm_user_name'));
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2020 10:55 PM
Not worked