- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 04:44 AM
When I query from Request tqble, the script includes return null . What could have gone wrong?
Script include
Client callable (checked)
Accessible from All Application Scopes
getFinanceRitm: function() {
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery("cat_item.sc_catalogsLIKEe0d08b13c33d1921e5f510100a9a"); //Finance Catalog
gr.query();
while (gr.next()) {
arr.push(gr.request.getUniqueValue());
}
gs.print("Request Number : " + arr);
return arr.toString();
Query from Request:
sysId is one of javascript:new global.CustomQueryUtils().getFinanceRitm()
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 05:03 AM - edited 05-27-2024 05:04 AM
Hi @tsoct ,
Please try the updated code below:
Script Include:
getFinanceRitm: function() {
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery("cat_item.sc_catalogsLIKEe0d08b13c33d1921e5f510100a9a"); //Finance Catalog
gr.query();
while (gr.next()) {
arr.push(gr.request);
}
gs.print("Request Number : " + arr);
return arr.toString();
},
Please consider marking my reply as Helpful and/or Accept Solution, if it helps. Thanks!
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 05:03 AM - edited 05-27-2024 05:04 AM
Hi @tsoct ,
Please try the updated code below:
Script Include:
getFinanceRitm: function() {
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery("cat_item.sc_catalogsLIKEe0d08b13c33d1921e5f510100a9a"); //Finance Catalog
gr.query();
while (gr.next()) {
arr.push(gr.request);
}
gs.print("Request Number : " + arr);
return arr.toString();
},
Please consider marking my reply as Helpful and/or Accept Solution, if it helps. Thanks!
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2024 05:09 AM
Hi @tsoct
try the below code.
getFinanceRitm: function() {
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery("cat_item.sc_catalogsLIKEe0d08b13c33d1921e5f510100a9a"); //Finance Catalog
gr.query();
while (gr.next()) {
arr.push(gr.request.sys_id.toString());
}
gs.print("Request Number : " + arr);
return arr
},
Thanks
dgarad