Filter Data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 01:34 PM
Hi,
I created a catalog item that added data to my custom table which is reference to location table.
I want to filter out the location list if location is already created in my custom table and still active.
How to achieve this requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 03:50 PM
Hi @Xhare ,
You can use the Dynamic Filter Options which is OOTB.
The call this reference qualifier wherever its required.
(function() {
var customTableGR = new GlideRecord('your_custom_table');
customTableGR.addQuery('active', true);
customTableGR.query();
var locationIds = [];
while (customTableGR.next()) {
locationIds.push(customTableGR.location.toString());
}
return 'sys_idNOT IN' + locationIds.join(',');
})();
Give appropriate name and save the record, table should be cmn_location
Open the catalog variable and in reference qualifier section select the dynamic option and then select the above created dynamic filter.
save the record and reload the catalog form and validate.
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar