- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 12:40 AM
Hello Everyone,
I have a custom table and in there there is a reference field 'REQ Number' available which references sc_request_list. Client requirement is when user click on the search option available on the reference field it should only pull up results - requests is raised from a particular catalog item only. Also user should not be able to see the results only the REQ which are raised by him/her. Hence I tried using Script Include called on Reference Qualifier but still it does not work. Attaching the screenshots from the custom table, Script Include that I created and calling that Script Include from Reference Qualifier.
Any suggestion will be highly appreciated.
Thank you in advance.
Code written on script include
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 04:54 AM
please use : instead of that colon word
javascript: var query; var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addQuery("cat_item.sys_id", "catItemSysId");
gr.query();
while (gr.next()) {
arr.push(gr.getValue('request'));
}
query = 'sys_idIN' + arr.toString();
query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 04:49 AM
@Chaitanya ILCR I tired removing the dot (.) and new keyword but it still does not work
@Ankur Bawiskar Also giving the correct sys ID of the catalog item does not work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 04:54 AM
please use : instead of that colon word
javascript: var query; var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addQuery("cat_item.sys_id", "catItemSysId");
gr.query();
while (gr.next()) {
arr.push(gr.getValue('request'));
}
query = 'sys_idIN' + arr.toString();
query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 04:58 AM
did you try running the script in background and see if it gave array of REQ sysIds?
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addQuery("cat_item.sys_id", "catItemSysId");
gr.query();
while (gr.next()) {
arr.push(gr.getValue('request'));
}
gs.info(arr.toString());
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 05:33 AM
using: instead of that colon word worked
Thank you so much
I have marked the solution as helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 05:36 AM
Glad to help.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader