- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2019 12:37 AM
Hello Payal,
Just small change in code.
var GetEquipments = Class.create();
GetEquipments.prototype = Object.extendsObject(AbstractAjaxProcessor, {
allEquipments:function(){
//var include = '';
var include = []; // Use array, push() & join(",") instead
var selectedLoc = current.variables.select_location;
var equ = new GlideRecord('u_location_equipments');
equ.addQuery('u_location', selectedLoc);
equ.query();
// while(users2.next()) Bug #1 - wrong variable name
while(equ.next()) // replaced with equ
{
//include += (',' + equ.u_equipment); Bug #2 - dot walking in while loop
include.push(equ.getValue('u_equipment').toString()); // use getValue instead
}
//return criteria string
return 'sys_id IN' + include; Bug
},
type: 'GetEquipments'
});
Also try adding logs to check that you are getting the correct values in array and getrowcount as well
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade