Applying reference qualifiers on standard change template proposals

Ashok Kumar Am1
Giga Expert

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.

find_real_file.png

Is there anyway to apply reference qualifiers on change template proposal screen? Please help.

Thanks

1 ACCEPTED SOLUTION

tomas_hanousek1
Kilo Expert

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. 

View solution in original post

22 REPLIES 22

Eric_Gauthier
Tera Contributor

We are wanting to do something similar.  Did you ever get any solutions to this?

Eric Gauthier, CSPO
BECU
ServiceNow Operations Engineer

Daniel Peel
Mega Sage

I'm guessing no one has found a way to do this?

 

I've never worked on this but can't you right click and define dictionary on the column ?

 

is this on the portal side or on the fullfillter UI? which table is this ?

Negative... they are not really fields you can right click on... because they are being stored in the template_values variable