- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2019 11:24 PM
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.
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'
});
-----------------------------------------------------------------
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 02:15 AM
Resolved. Just need to write below line in "Select Equipments" reference qualifier,
javascript:'u_location='+current.variables.select_location

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 12:46 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 01:44 AM
I tried it but still giving No "Matches Found"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 02:14 AM
Can you share a complete screenshot of the script include?
Thanks,
Abhishek
Abhishek Gardade
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 02:15 AM
Resolved. Just need to write below line in "Select Equipments" reference qualifier,
javascript:'u_location='+current.variables.select_location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2019 02:17 AM
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
Abhishek Gardade