How can we display specific values in the List collector?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 12:10 PM - edited 07-22-2024 12:12 PM
How can we display specific values in the List collector?
Scenario : We currently have a list table of groups, however, it is displaying all groups when we specifically need to see only four groups: 1. Database, 2. Software, 3. Service Desk, and 4. Infrastructure.
Please help me on this .
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 12:25 PM - edited 07-22-2024 12:26 PM
Hello,
You can add a reference qualifier JavaScript as follows: add "javascript:" as prefix to below code as seen in screenshot.
var allowedGroups = ['Database', 'Software', 'Service Desk', 'Infrastructure'];
var groupFilter = allowedGroups.map(function(group) {
return 'name=' + group;
}).join('^OR');
answer = groupFilter;
Hope this helps!
Regards, Akash
_____________________________________________________________________________
Please mark it as helpful 👍 or Accept Solution ✔️ based on the response to your query.
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2024 12:48 PM - edited 07-22-2024 12:51 PM
Hi @ramuv ,
Script Include:
var GroupFilter = Class.create();
GroupFilter.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getGroups: function() {
var gr = new GlideRecord('sys_user_group');
gr.addQuery('name', 'IN', 'Database,Software,Service Desk,Infrastructure');
gr.query();
var result = [];
while (gr.next()) {
result.push(gr.getUniqueValue());
}
return result.join(',');
}
});
Apply the Script Include to the Reference Qualifier:
javascript: new GroupFilter().getGroups()
……………………………………………………………………………………………………
Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand.