- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 04:04 PM
So I need to filter this reflist.
Does anyone know where I can filter this? We only use a few of the classes and I don't want users select the wrong ones. They will be empty.... but it would lead to confusion if they still 600 classes ... when we only use about 15 for now.
this is url that the link brings up
<a id="lookup.child_table_field" tabindex="-1" class="icon-search btn btn-default sn-tooltip-basic" title="Lookup using list" onclick="mousePositionSave(event);reflistOpen( 'child_table_field', 'not', gel('child_table_fieldTABLE').value, '', 'false', 'QUERY:super_class.nameINSTANCEOFcmdb_ci^ORname=cmdb_ci', 'super_class.nameINSTANCEOFcmdb_ci^ORname=cmdb_ci', '')"><span class="sr-only">Lookup using list</span></a>
I found references to reflistOpen in some templates... but not where to pass filters into it.
thanks for any help
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 06:45 PM
There's no way to get to that filter directly to modify it, so you have to detect (and modify) the query that returns those values. You should be able to accomplish this with a business rule on the 'sys_db_object' table. The business rule will have a 'When' value of 'Before' and the 'Query' checkbox checked. It will identify this specific query and then restrict it a bit further with your own custom encoded query to return just the CI types you want. You should just have to set this up and then add your own encoded query with your CI types. The included script here shows you how you could restrict this to Server and Business Service CIs. Here is the script...
(function executeRule(current, previous /*null when async*/) {
// Adjust the list of CI classes returned in 'Add' CI dialog
// Get URL parameter values so we can identify just this query
var qual = RP.getParameterValue('sysparm_additional_qual');
var target = RP.getParameterValue('sysparm_target');
// If we find a match restrict the query
if (qual.indexOf('cmdb_ci') > -1 && target == 'child_table_field') {
// Add custom encoded query for the 'sys_db_object' table here
current.addEncodedQuery('super_class.nameINSTANCEOFcmdb_ci_server^ORname=cmdb_ci_service');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 08:41 AM
Unfortunately that UI Page is not accessible according to this KB article:
https://hi.service-now.com/kb_view.do?sysparm_article=KB0713599
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2020 08:38 AM
Sorry, seeing this only now. In a previous reply I specified what I did: "What I did is add the required filter as a parameter and then updated the script include AssociateCIToTask, function get URL, to include in the filters that is pulling the data."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2019 07:16 AM
I looked up my work on this as I did the work some time ago. What I did is add the required filter as a parameter and then updated the script include AssociateCIToTask, function get URL, to include in the filters that is pulling the data.