Advanced reference qualifier not working when I paste or type values on field

Lucas Romani1
Tera Contributor

Hi,

I am using an advanced reference qualifier on a reference field that calls a script include:

-> Qualifier: javascript : new ChangeRequestUtils().incidentSource(current);

-> Script Include:

 

	incidentSource: function(current) { //current is a change_request record
		if(current.type == 'emergencial' || current.type == 'emergency') {
			var sysId = '';	
			var gr = new GlideRecord('incident');
				gr.addEncodedQuery('priorityIN1,2');
				gr.query();	
			while(gr.next()) {
				sysId += gr.sys_id + ',';
			} 	
			return 'sys_idIN' + sysId;
		}
	}

 

When I use the search icon (magnifying glass) on the reference field, the filters that I made on script include works and show the incident filtered results. But when I try to put directly on the field an specific incident value (copy and paste) or type any incident value on the field, it accepts everything (even the incident) record is not part of the specific filter in the include script)

 

Anyone know what is happening ? Is it possible to filter works also when I fill manually the reference field ?

12 REPLIES 12

-O-
Kilo Patron
Kilo Patron

I have also noticed this on other reference fields: when searching by pressing the magnifying glass + popup, the reference qualifier is used, but if a valid display name is pasted it is actually accepted, even though the pasted display value/record should have been filtered out by the reference qualifier. Happens on Change records.

@-O- 

Did you achieve any way to apply the advanced referece qualifier filters also when paste value on the reference value ?

No, it is a mystery still.

I'm hoping someone has some idea here 🙂

@-O- Maybe an onChange client script that runs every time that the reference field change value ? (Is this case, the script include would be called by the client script to validate if the value entered on the field is a valid value or not)