- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 05:58 PM
Hi Folks,
How can I obtain the Sys_ID of each request number (REQ) in bulk?
I hope someone can help me.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 03:28 AM
Hi @AydeeH,
You can use background script and if you have specific query to be built, build it on list view and copy the query from breadcrumbs.
var grRequest = new GlideRecord('sc_request');
grRequest.addEncodedQuery('PASTE_THE_COPIED_BREADCRUMB_QUERY'); //query as per your requirement
grRequest.query();
while (grRequest.next()) {
gs.info('Req Number : '+ grRequest.getValue('number') + ' Sys ID: ' + grRequest.getValue('sys_id'));
}
If you found my reply useful, please mark it as SOLUTION and HELPFUL.
Thanks and Regards,
Ehab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 06:24 PM
Try running something like the following in Scripts - Background
var scRequests = [];
var scReq = new GlideRecord('sc_request');
scReq.addQuery('active', true); // use desired query
scReq.query();
while (scReq.next()) {
scRequests.push(scReq.sys_id.toString());
}
gs.info ("scRequests = " + scRequests);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 07:06 PM
Hi @AydeeH ,
You can try the below in background script:
var grReq = new GlideRecord('sc_request');
grReq.addQuery('active', true); //query all active Req(s)
grReq.query();
while (grReq.next()) {
gs.info('Req Number : '+ grReq.getValue('number') + ' Sys ID: ' + grReq.getValue('sys_id'));
}
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 03:28 AM
Hi @AydeeH,
You can use background script and if you have specific query to be built, build it on list view and copy the query from breadcrumbs.
var grRequest = new GlideRecord('sc_request');
grRequest.addEncodedQuery('PASTE_THE_COPIED_BREADCRUMB_QUERY'); //query as per your requirement
grRequest.query();
while (grRequest.next()) {
gs.info('Req Number : '+ grRequest.getValue('number') + ' Sys ID: ' + grRequest.getValue('sys_id'));
}
If you found my reply useful, please mark it as SOLUTION and HELPFUL.
Thanks and Regards,
Ehab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 03:56 PM
Thank you everyone!