Help with Advanced Reference Qualifier for Incident Form

JP-ODU
Tera Guru

We're testing adding two new location fields to our incidents, and (with help) I was able to set up an advanced reference qualifier on the record producer so that, on the service portal side, a customer could select a Building ([u_university_building] table) and the subsequent field would display only Rooms ([u_university_rooms] table) that correspond to that building. Now, I've been asked to apply that same filtering on the back end, when a fulfiller is entering an incident in the platform view.

On the incident form, I was able to configure dictionary on my INC Room field (u_inc_room), set an advanced reference qualifier, and fill in the javascript I used for the record producer. But it's not working. I'm guessing something is wrong with my script. Can someone show me how to amend it? It's supposed to check against the entry in the u_inc_building field and then return only rooms that match that building

The reference qualifier from the record producer is: 

javascript:new getRooms().rooms(current.variables.u_inc_building);

The script include it calls is 

 

 

 

var getRooms = Class.create();
getRooms.prototype = {
	initialize: function() {
	},
	rooms:function(building)
	{
		var rooms =[];
	var gr = new GlideRecord('u_university_rooms');
		gr.addQuery('u_bdlgcode',building);
		gr.query();
		while(gr.next())
			{
				rooms.push(gr.sys_id.toString());
			}
		return "sys_idIN"+rooms.toString();
	},
	
	type: 'getRooms'
};

 

 

 

 

1 ACCEPTED SOLUTION

I found it, my own dumb error. Trying to call with the exact same javascript I used in the record producer version doesn't work because, in comparison, our Incident form has no variables. So the correct way to do it is:

javascript:new getRooms().rooms(current.u_inc_building);

removing the "variables." portion from my 

javascript:new getRooms().rooms(current.variables.u_inc_building);

But I also probably still needed it client-callable, so I am extremely appreciative of your input

View solution in original post

4 REPLIES 4

Elijah Aromola
Mega Sage

Is your script client callable? If not, set that to true and update your script to the below and try again.

var getRooms = Class.create();
getRooms.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    initialize: function() {},
    rooms: function(building) {
        var rooms = [];
        var gr = new GlideRecord('u_university_rooms');
        gr.addQuery('u_bdlgcode', building);
        gr.query();
        while (gr.next()) {
            rooms.push(gr.sys_id.toString());
        }
        return "sys_idIN" + rooms.toString();
    },

    type: 'getRooms'
};

Thanks for your help! I tried as you suggested, updating to client-callable and updating with your included script, though I did add a ) at line 16.

It still works just as it did before on the portal-side for customers, but trying to call it in the platform as a fulfiller it still seems to not work/be unresponsive. Any ideas?

Portal/client:

portal.png

Platform/fulfiller:

platform.png

Can you post your full scripts and add maybe some log messages to verify it's being called when you open the field? 

I found it, my own dumb error. Trying to call with the exact same javascript I used in the record producer version doesn't work because, in comparison, our Incident form has no variables. So the correct way to do it is:

javascript:new getRooms().rooms(current.u_inc_building);

removing the "variables." portion from my 

javascript:new getRooms().rooms(current.variables.u_inc_building);

But I also probably still needed it client-callable, so I am extremely appreciative of your input