- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2021 03:17 PM
I have a catalog item (hr request) that includes a List Collector.
I have a reference qualifier running correctly to filter that list based on the department. I am also hiding the filter section based on the attribute "no_filter". Everything is working fine.
However if the user/agent changes the department, the list collector does not update.
I am looking for an onChange client script that would force the list collector to refresh when the department is changed/
Thanks in advance for help
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2021 03:31 PM
Hey,
You don't need a script, just update the variable to watch the element(s) you're wanting to use in the reference qual. There is a (poorly) documented attribute 'ref_qual_elements' that you use.
1. The variable on the form I want to include in the reference qual.
2. The variable name to watch (if you're using multiple, separate with ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2021 03:22 PM
Here's an article from ServiceNow Guru from a few years ago that I believe still works - Changing the Filter of a List Collector Variable via Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2021 04:14 PM
I had found that too... too complicated for just a refresh.
Kieran's answer was bang on.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2021 01:56 PM
Yeah, that was the only way we could do it way back when before the attribute was added. I fell into the trap of answering your actual question asking for a Client Script instead of giving a proper solution. I usually shout out "why?" when I see others do that - I guess it had been a long week. ????

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 10:45 AM
We have been using the solution referenced on the ServiceNow Guru site quite successfully for a while.
However we recently came across a problem.
Our implementation of the Catalog Client Script works in Service Portal, but does not work in the Standard UI.
We were using the script changing only the variable name and the filter string. Of course, we may be doing something wrong.
I am a little curious as to whether and how these statement may now be behaving differently in the Standard UI:
//Reset the filter query
window[collectorName + 'g_filter'].reset();
window[collectorName + 'g_filter'].setQuery(filterString);
window[collectorName + 'acRequest'](null);
In any event, we found this article and the solution works for us in both Service Portal and Standard UI.
Thanks All for posting the question, the answer, and the useful comments!