Fetching filtered query from List view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 11:01 PM
Hi All,
I am working on a requirement where I need to design a UI action for exporting CSV file of List filtered on RITM table. As the formatting of CSV file that Servicenow gives by default is different from our requirement, so we are writing Fix script to manage rows and columns of exported file.
But as filter condition of list view will be dynamic , so wanted to know if there is any way we can dynamically fetch Encoded query of current list view and place it in our query of script.
var gr = new GlideRecord(table);
gr.addEncodedQuery("metric.metric_type.evaluation_method=survey");
gr.query();
Highlighted query should be dynamic one as per the filter of current list page.
Thanks in advance!!
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 11:12 PM
Hi prema
Try this and check below links
var uri = gs.action.getGlideURI(); // gives object from type GlideURI()
var quer = uri.get('sysparm_fixed_query'); // extracts fixed encoded query string
var quer2 = uri.get('sysparm_query'); // extracts users query string
gs.addInfoMessage(quer);
gs.addInfoMessage(quer2);
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2022 11:12 PM
Hi,
what do you mean by filter of current list page?
multiple users can apply multiple filters on table list
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 12:42 AM
Hi
Suppose Customer A put filter "State= Open and Active= True"
Customer B put filter "State=Closed and Active= True and Catalog item = XYZ"
When Customer A is clicking on our Custom UI Action then I should get encodedquery for State=Open and Active= True. But if Customer B clicks on our UI Action then t should give me encoded query like State=Closed and Active=True and Catalog Item = XYZ.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 12:47 AM
Hi,
okay can you share what type of UI action it is?
Client side or server side
please share script and UI action configuration
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader