- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 09:09 PM
Hello,
I have created the following Catalog Client Script and Script Include. The purpose of this code is to enhance my understanding of its functionality. However, the code failed to return a value. Could someone please assist in identifying the reason for its failure? Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 09:34 PM
Hi @Keang
Let's try to change the result object in your script include a little bit. Also make sure you have enabled the Client Callable checkbox for your script include.
var GetRITMInfo = Class.create();
GetRITMInfo.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
ritmNumber: function() {
var sysIdNumber = this.getParameter("sysparm_sysID");
var grNumber = new GlideRecord('sc_req_item');
grNumber.get("sys_id", sysIdNumber);
var result = {
"RITM Number ": grNumber.getValue('number'), //getValue or parse to string
"RITM Description": grNumber.getValue('description'), //getValue or parse to string
};
return JSON.stringify(result);
},
type: 'GetRITMInfo'
});
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 11:36 PM
Hi @Keang
Let's try one of below.
"Start Date": grNumber.variables.start_date.toString(),
//"Start Date": grNumber.variables.start_date.getValue(),
//"Start Date": grNumber.variables.start_date.getDisplayValue(), //display value for reference type
Cheers,
Tai Vu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:39 PM
for reference field you can use getDisplayValue('field_name')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:41 PM
Thank you @Dhananjay Pawar
I have tired that, but it is not working:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:44 PM
Hi,
try below,
grNumber.getDisplayValue('requested_for');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:43 PM
@Dhananjay Pawar , It was my bad. There is a type in the code, It is working now. However, any idea how I can capture the variable as well. Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 10:47 PM
for variables you can try
grNumber.variables.variable _name; // here you need to change the variable names