g_list is undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2018 04:26 AM
Hi ServiceNow community,
I was trying out a custom UI action (list ui, set to client side), when I tried scripting it. More specifically, I am trying to get the list of checked items using g_list.
I tried to use g_list, but it keeps telling me g_list is undefined. Am I doing something wrong?
Here is my code that will alert on an error: (note that I have not configured it to refresh the page automatically and I still have to refresh it manually for now after click the list UI action)
/*jshint esnext: true */
try{
const selected = g_list.getChecked();
alert(selected);
} catch(err) {
alert(err.message);
}
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2018 04:30 AM
MAke sure its a v2 list and not v3 only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2018 04:33 AM
Hi, yes it is set as v2 list, most of the settings areOOTB, I only changed the script, set it to client, and set it as a List UI Action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2018 04:54 AM
The problem with this is that the code is not encapsulated in a function, and there is no function called in the field 'onClick'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2018 05:00 AM