How can we display specific values in the List collector?

ramuv
Tera Expert

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

2 REPLIES 2

Akash4
Kilo Sage
Kilo Sage

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;

 

Akash4_0-1721676245265.png

Akash4_1-1721676325414.png

Hope this helps!
Regards, Akash
_____________________________________________________________________________
Please mark it as helpful 👍 or Accept Solution ✔️ based on the response to your query.

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

Satishkumar B
Giga Sage
Giga Sage

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()

 

 

 

SatishkumarB_0-1721677596303.png

 

……………………………………………………………………………………………………

Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand