- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2017 12:08 PM
Hi there,
This is related to standard change template proposal screen. In our environment while proposing change template 'Configuration field' is one of the mandatory field.
And using Configuration field look up i am able to select any CI record .But my requirement here is to restrict CI selection only for certain class.
Is there anyway to apply reference qualifiers on change template proposal screen? Please help.
Thanks
Solved! Go to Solution.
- 6,249 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:17 PM
I implemented that. Let's say you want to make a reference qualifier to the for Configuration item on the template. Then you have to create the Before Query Business Rule that looks like this (on cmdb_ci table)
(function executeRule(current, previous /*null when async*/) {
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
if (targetName.indexOf('change_request.cmdb_ci') > -1) {
current.addQuery('install_status', 1); // installed
}
})(current, previous);
When you click the magnifying glass, there is a parameter in URL sysparm_target that always differ a little bit. On the change form it's just change_request.cmdb_ci, and on change proposal, it has format like change_request.cmdb_ci.{sys_id format}. So you can detect it like this. Then you are able to provide only specific CIs after clicking on magnifying glass.
You should also take care about the putting the Name of CI directly to the field. You cannot find the CI in the list after clicking on magnifying glass, but when you put the name into the field, it behaves as valid. Here I suggest to use client script with AJAX to check if the user put there valid CI.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 10:53 AM
I found the catalog item, but I'm on Kingston so the propose standard change form no longer has that CI item reference variable for me.
But, if that is a type of reference variable, you can go into the table contain all the variables, find that variable, give it a ref qual . I'm pretty sure you can do that with a reference variable.
You can give ref qual to either reference variable, choice look up, multi choice look up.. I think, off top my head
item_option_new is the table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2018 02:17 PM
I implemented that. Let's say you want to make a reference qualifier to the for Configuration item on the template. Then you have to create the Before Query Business Rule that looks like this (on cmdb_ci table)
(function executeRule(current, previous /*null when async*/) {
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
if (targetName.indexOf('change_request.cmdb_ci') > -1) {
current.addQuery('install_status', 1); // installed
}
})(current, previous);
When you click the magnifying glass, there is a parameter in URL sysparm_target that always differ a little bit. On the change form it's just change_request.cmdb_ci, and on change proposal, it has format like change_request.cmdb_ci.{sys_id format}. So you can detect it like this. Then you are able to provide only specific CIs after clicking on magnifying glass.
You should also take care about the putting the Name of CI directly to the field. You cannot find the CI in the list after clicking on magnifying glass, but when you put the name into the field, it behaves as valid. Here I suggest to use client script with AJAX to check if the user put there valid CI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2020 07:43 AM
Your answer should be marked correct. Your script saved some of us a lot of time. Thank you for posting your solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2020 11:46 PM
Thanks! tomas_hanousek
But how should we give the sysid as it keeps changing always. If you have implemented this change_request.cmdb_ci.{sys_id format}. Could you please help me getting the value for {sys_id format}. And if i only use change_request.cmdb_ci, it is causing an issue in other configurations.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2020 06:27 AM
CAUTION!!
The above solution worked but however this BR has to be turned off in our instances due to the excessive logging in our log table which occupied nearly 90% of data. We had to turn this off.
Please test it for logging in your sub prod instances if you are use this BR before migrating it to PROD.
Good Luck!!
Thanks & Regards
Shan