- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-08-2019 03:38 AM
Good day everyone š
I would like to ask for some help, we have this requirements to Invite All users found on the filtered related list (see sample screenshot below: to invite 76 users at once by clicking Invite All UI action). the total number of records is changing based on the filter(s) selected by the user (sample Invited=false > Excluded = false > Computer Location City > Gurugram).
Related list filter(s) is dynamic per admin user's input (but this filter is fixed Invited=false > Excluded = false since we will only invite those users who were not invited yet)
Once the admin provided some filters, then click Invite All ---- i want to get the related list filter(s), and do the GlideRecord after to update Invited column to true. How to get the related list query using Invite All UI action?
sample:
If need more samples/explanation please let me know so i can provide. I would love to discuss and learn from you.
Thank you so much
Jigs
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-08-2019 04:48 PM
Hello,
You can access the related lists on the bottom of the page using GlideList2 API. Here is the documentation for GlideList2:
https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=c_GlideList2API
You will see that using the "get(id)" function in GlideList2, you can get the instance of the related list tab. And then by using the "getQuery()" function or ".filter" attribute, you can access the applied filter.
So you will need to use client side code in your UI Action. In the client side action, use the following code:
//You need to specify the Id of the related list to get its instance
var relatedList = GlideList2.get("id of the related list");
if(relatedList) {
var filter = relatedList.getQuery();
// OR you could use the following
//var filter = relatedList.filter;
}
Following explains how you can find the ID of the related list tab:
Using the browser developer tools, inspect the hamburger button for the tab you want to get the query from. Try to find the attribute 'data-list-id' for that related list tab. That is the "listId" to be passed in the following call:
GlideList2.get(listId);
Hope this helps!
Cheers,
Manish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-22-2019 03:13 PM
Namaste Jigs,
Glad that it worked š
Cheers,
Manish