- 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 11:19 PM
@Dhananjay Pawar , It returns not value: "Start Date":{}}"
- 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-22-2024 09:48 AM
Thank you so much for helping @Tai Vu
I just wanted to inform you that this code successfully displays catalog item variables.