Reference qualifier for list collector via script include does not work

Payal5
Kilo Expert

Hi All,

I am looking for help in identifying any issue with the following piece of Script Include code. I have two variable in 'Select location' (references to cmn_location table) and 'Select equipments' (Type-List collector (u_location_equipments)).

I have requirement to create reference qualifier on 'select equipments' variable based on 'select location'.For ex. If location is AC - FF – 001 then it should show only Projector, Video Conferencing Solution (WebEX), Table MIC.

find_real_file.png

I'm using below script include but it is not working,

----------------------------------------------------------------------------

var GetEquipments = Class.create();
GetEquipments.prototype = Object.extendsObject(AbstractAjaxProcessor, {

allEquipments:function(){

var include = '';
var selectedLoc = current.variables.select_location;

var equ = new GlideRecord('u_location_equipments');
equ.addQuery('u_location', selectedLoc);
equ.query();

while(users2.next())
{
include += (',' + equ.u_equipment);
}

//return criteria string
return 'sys_id IN' + include;
},

type: 'GetEquipments'
});

-----------------------------------------------------------------

 

find_real_file.png

 

1 ACCEPTED SOLUTION

Payal5
Kilo Expert

Resolved. Just need to write below line in "Select Equipments" reference qualifier,

javascript:'u_location='+current.variables.select_location

View solution in original post

9 REPLIES 9

Sanket Khabiya
Kilo Sage

Hi Payal,

Hope below code helps you!!!

Script Include :
Name : GetEquipments
API Name : global.GetEquipments

--------------------------------------------------------------------
function GetEquipments(){
var array = [];
var location = current.variables.select_location;

var gloc = new GlideRecord('u_location_equipments');
gloc.addEncodedQuery('u_location='+location);
//gs.addInfoMessage(gloc.getEncodedQuery());
gloc.query();
while(gloc.next())
{
array.push(gloc.getValue("u_equipment"));

}
gs.addInfoMessage(array.toString());
return 'sys_idIN' +array;
}

--------------------------------------------------------------------
Add Reference Qualifier on the variable "select_location" :

javascript:global.GetEquipments();

--------------------------------------------------------------------

Regards,
Sanket

Payal5
Kilo Expert

I tried it but still giving No "Matches Found"

Can you share a complete screenshot of the script include?

Thanks,
Abhishek

Thank you,
Abhishek Gardade

Payal5
Kilo Expert

Resolved. Just need to write below line in "Select Equipments" reference qualifier,

javascript:'u_location='+current.variables.select_location

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you,Abhishek

Thank you,
Abhishek Gardade