
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2023 09:29 AM
When creating or modifying a standard change the configuration item field does not filter out retired CIs like it does when choosing a CI on a change record. Is there any way to get this to work or some sort of workaround?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2023 10:51 AM
Hi @Brian Lancaster ,
Here is an old KB on why and a suggested resolution.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0723752
Create a Before Query type business rule on cmdb table to filter out the retired records.
Here is an community post that has a script example:
https://www.servicenow.com/community/developer-forum/applying-reference-qualifiers-on-standard-chang...
Regards,
Niklas

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 02:20 PM
Figured it out. Since I did not want to limit the entire system to just things that had an install status of installed I used operational status as that appears to be the same for all CMDB tables. So I just change the before query to the code below.
(function executeRule(current, previous /*null when async*/ ) {
current.addQuery('operational_status', '!=', 6); // Anything other then retired
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2023 10:51 AM
Hi @Brian Lancaster ,
Here is an old KB on why and a suggested resolution.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0723752
Create a Before Query type business rule on cmdb table to filter out the retired records.
Here is an community post that has a script example:
https://www.servicenow.com/community/developer-forum/applying-reference-qualifiers-on-standard-chang...
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 11:14 AM - edited ‎08-22-2023 11:31 AM
This doesn't seem to work if someone just start typing in the configuration item field. It does work if they click on the magnifying glass however. But I know everybody is just going to start typing in the name of the CI.
Edit: It seems to be this part of the code. If you just type it return null as the answer but if you click the magnifying glass it returns change_request.cmdb_ci.69023fa0690297006902da4069023d80.
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 12:16 PM
I found the main problem. I was trying to not be so restrictive since this can affect the entire system. So I tried to change it to
current.addQuery('install_status', '!=', 7);
which is retired. The problem comes in that 7 is not retired for all classes. Are retired CIs are in Business Application which yes I know technically your not supposed to use that as an operational CI but that is what are vendor had use do until we could start coming up with Application Services. For some reason the class of Business Applications retired is 3 which for all other CIs is In Maintenance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2023 02:20 PM
Figured it out. Since I did not want to limit the entire system to just things that had an install status of installed I used operational status as that appears to be the same for all CMDB tables. So I just change the before query to the code below.
(function executeRule(current, previous /*null when async*/ ) {
current.addQuery('operational_status', '!=', 6); // Anything other then retired
})(current, previous);