GlideList API - How to get records sys ids?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 11:17 AM
Hi folks,
I am playing with custom UI context menu action that allows ITIL users to bulk update the records.
The plan is to merge OOB "Update Selected" and "Update all" UI context menu actions.
So, I want to pass a comma-seperated list of ids to script include via ajax and I've found it quite challenging as I am not that familiar with the Glidelist API.
I know that for selected records I can utilize the g_list.getChecked() which is briliant and works exactly as I expected - it returns a list of sys_ids of currently checked records.
Question: Is there any method that does exactly the same as getChecked() but for all records in the list?
I need a comma-seperated lists of records to put them in a gliderecord query - like gr.addEncodedQuery('sys_idIN' + listsOfrecords)
Cheers,
Maciek

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 12:07 PM
You can print glide list sys_id using below sample script, watch list is a glide list field.
var inc = new GlideRecord('incident');
inc.addEncodedQuery('watch_listLIKE' + getUserSID('Abel Tuter'));
inc.query();
while (inc._next()) {
gs.print(inc.number + " | " + inc.watch_list);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 12:22 PM
thanks, but how this help me with the UI context menu action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 02:51 PM
nvm, g_list.getQuery() is all I need <facepalm>