The CreatorCon Call for Content is officially open! Get started here.

Report of Users in only one group?

Brian Bouchard
Mega Sage

Is there a way to generate a report, on platform, of users in one group?  Note, I'm not trying to find all users in a specific group. I just want to know which users are in a single group (could be any group) at a given point in time.

1 ACCEPTED SOLUTION

AndersBGS
Tera Patron
Tera Patron

Hi @Brian Bouchard ,

 

Create a report based on the sys_user which related list condition for group where equal to 1 as shown below:

AndersBGS_0-1715839309425.png

If my answer has helped with your question, please mark my answer as accepted solution.

 

Best regards

Anders 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

View solution in original post

3 REPLIES 3

Harsh Vardhan
Giga Patron

Hi @Brian Bouchard  You can try with script , create one client callable script include and call it in your report. 

 

Sample Code: 

 

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

    test: function() {
        var arr = [];
        var ga = new GlideAggregate('sys_user_grmember');
        ga.addAggregate('COUNT', 'user');
        ga.query();
        while (ga.next()) {
            var ucount = ga.getAggregate('COUNT', 'user');
            if (ucount == 1) {
                var ga1 = new GlideAggregate('sys_user_grmember');
                ga1.addEncodedQuery('user=' + ga.user);
                ga1.addAggregate('count', 'sys_id');
                ga1.query();
                while (ga1.next()) {
                    arr.push(ga1.getUniqueValue());
                    //gs.print('User  '+ ga.user.getDisplayValue() + '   Is only available in  this group   ' + ga1.group.getDisplayValue());
                }
            }

        }
        return arr.join(',');
    },

    type: 'checkNew'
});

 

Note: Report will be on Group Member table and use below filter.

Sys ID | IS One Of | javascript : new checkNew().test()

 

Hope it will help you.

 

Thanks,

Harsh

 

James Chun
Kilo Patron

Hi @Brian Bouchard,

 

I think you can use the 'Related list conditions' in the report for this, something like the following:

 

JamesChun_0-1715805011061.png

Make sure you set the Quantity to Equal to 1.

 

Cheers

AndersBGS
Tera Patron
Tera Patron

Hi @Brian Bouchard ,

 

Create a report based on the sys_user which related list condition for group where equal to 1 as shown below:

AndersBGS_0-1715839309425.png

If my answer has helped with your question, please mark my answer as accepted solution.

 

Best regards

Anders 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/