- 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,317 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
‎03-04-2025 03:26 AM
Urgent help required:
Is there a way to format these below two lines of script in such a way so that it can be added into the conditions field in Business Rule?
Thanks in advance.
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target'); if (targetName.indexOf('change_request.cmdb_ci') > -1) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 03:31 PM - edited ‎03-05-2025 03:34 PM
I'm not sure what you are asking makes sense, but functionally in JavaScript lines separated by the ; can be placed on a single line but would be interpreted as individual lines of code.
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
if (targetName.indexOf('change_request.cmdb_ci') > -1) {
is functionally the same as
var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');if (targetName.indexOf('change_request.cmdb_ci') > -1) {
but the condition field is not the same field, but is in the same scope, of the script field so would need to use "complete" code in the condition. However, the targetName variable would be available to the script field.
javascript:var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');if (targetName.indexOf('change_request.cmdb_ci') > -1) { true }
replace the : with a :
it doesn't like the colon lol
if you then say put something like gs.addInfoMessage(targetName) in the script field you would get a message that contained the value of targetName.
I'd really question doing this IN the condition field... not sure the gain.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2024 08:51 AM
It looks like this approach is no longer possible
Standard Change template proposals do not honor reference qualifiers on change_request table fields ...
especially if what you want to edit is part of std_chg_template_val_render