- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 11:55 AM - edited ‎11-16-2022 11:58 AM
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'
};
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2022 08:23 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 12:28 PM
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'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2022 12:45 PM
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:
Platform/fulfiller:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2022 07:49 AM
Can you post your full scripts and add maybe some log messages to verify it's being called when you open the field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2022 08:23 AM
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