Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I use the following script include to return only room options (u_university_rooms table) that match the selected building code ("u_bldgcode")
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_bldgcode', building);
gr.query();
while (gr.next()) {
rooms.push(gr.sys_id.toString());
}
return "sys_idIN" + rooms.toString();
},
type: 'getRooms'
});
I'd like to add the requirement that the options from u_university_rooms *also* be u_active = True
My attempt, below (add "if(u_active="true")/return;"), isn't working:
var getRooms = Class.create();
getRooms.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize: function() {},
rooms: function(building) {
var rooms = [];
var gr = new GlideRecord('u_university_rooms');
if(u_active="true")
return;
gr.addQuery('u_bldgcode', building);
gr.query();
while (gr.next()) {
rooms.push(gr.sys_id.toString());
}
return "sys_idIN" + rooms.toString();
},
type: 'getRooms'
});
What am I missing?
Thanks!
Solved! Go to Solution.
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Try below
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_active', true);
gr.addQuery('u_bldgcode', building);
gr.query();
while (gr.next()) {
rooms.push(gr.sys_id.toString());
}
return "sys_idIN" + rooms.toString();
},
type: 'getRooms'
});
Please hit like and mark my response as correct if that helps
Regards,
Musab
Regards,
Musab
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Try below
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_active', true);
gr.addQuery('u_bldgcode', building);
gr.query();
while (gr.next()) {
rooms.push(gr.sys_id.toString());
}
return "sys_idIN" + rooms.toString();
},
type: 'getRooms'
});
Please hit like and mark my response as correct if that helps
Regards,
Musab
Regards,
Musab
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Perfect fix! Thanks!