<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Active groups with no members and Roles in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533132#M104911</link>
    <description>&lt;P&gt;Hello &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="00383130db6c1190fd8d2b69139619ae"&gt;@Ashik Suresh&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try something like this and call it in your report:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;getActEmptyGrps: function() {
        var arrG = [];
        var grA = new GlideRecord("sys_user_group");
        grA.addActiveQuery();
        grA.query();
        while (grA.next()) {
            var grG = new GlideAggregate("sys_user_grmember");
            grG.addQuery("group", grA.getUniqueValue());
            grG.addAggregate("COUNT");
            grG.query();
            if (grG.next()) {
                if (grG.getAggregate("COUNT") == 0) {
                    var grR = new GlideAggregate("sys_group_has_role");
                    grR.addQuery("group", grA.getUniqueValue());
                    grR.addAggregate("COUNT");
                    grR.query();
                    if (grR.next()) {
                        if (grR.getAggregate("COUNT") == 0) {
                            arrG.push(grA.getDisplayValue());
                        }
                    }
                }
            }
        }
        return arrG.toString();
    },&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In Report your filter condition would be like below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="blob:https://community.servicenow.com/87691932-7d8a-4189-b08f-29218ee3c42b" /&gt;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Murthy&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2022 06:45:08 GMT</pubDate>
    <dc:creator>Murthy Ch</dc:creator>
    <dc:date>2022-07-05T06:45:08Z</dc:date>
    <item>
      <title>Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533125#M104904</link>
      <description>&lt;P&gt;I wanted to filter out the active groups with no members and roles.&lt;/P&gt;
&lt;P&gt;I navigated to sys_user_group and when i tried out the filters, i could get the active groups with no members. But i cant filter out the groups with no roles.&lt;/P&gt;
&lt;P&gt;I tried the filter 'Group. Roles' is 'empty'. But not showing up the results.&lt;/P&gt;
&lt;P&gt;Could anyone please help me?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 05:16:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533125#M104904</guid>
      <dc:creator>ashikcsures</dc:creator>
      <dc:date>2022-07-05T05:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533126#M104905</link>
      <description>&lt;P&gt;Hi Ashik&lt;/P&gt;
&lt;P&gt;How did you acheived the first one? where are you using this filters?&lt;/P&gt;
&lt;P&gt;group roles and group members are stored in seperate tables.&lt;/P&gt;
&lt;P&gt;Group Roles - sys_group_has_role, Group Members - sys_user_grmember&lt;/P&gt;
&lt;P&gt;If you are using reports then you can use related list conditions to filter no members and no roles.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/31613i6457673221120FF6/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 05:25:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533126#M104905</guid>
      <dc:creator>Voona Rohila</dc:creator>
      <dc:date>2022-07-05T05:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533127#M104906</link>
      <description>&lt;P&gt;Hi &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="00383130db6c1190fd8d2b69139619ae"&gt;@Ashik Suresh&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Group roles, you can query on table "&lt;STRONG&gt;sys_group_has_role&lt;/STRONG&gt;"&lt;/LI&gt;
&lt;LI&gt;Member, you can query on table "&lt;STRONG&gt;sys_user_grmember&lt;/STRONG&gt;"&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;So you can use these 2 tables and get the details.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;SPAN style="color: #34a853;"&gt;&lt;EM&gt;Please mark my answer as correct if this solves your issues!&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;If it helped you in any way then please mark helpful!&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Thanks and regards&lt;/STRONG&gt;,&lt;/P&gt;
&lt;P&gt;Kartik&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 05:29:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533127#M104906</guid>
      <dc:creator>kartiksethi</dc:creator>
      <dc:date>2022-07-05T05:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533128#M104907</link>
      <description>&lt;P&gt;The purpose of this is to create a report on Active groups with no members and roles. I navigated to 'sys_user_group' and done the following :&lt;/P&gt;
&lt;P&gt;&lt;IMG src="blob:https://community.servicenow.com/3e8f2e7f-0340-4e62-9b2a-5548edf7e31b" /&gt;&lt;/P&gt;
&lt;P&gt;Here i couldnt mention roles as empty. If it could be done with a related list condition, could you pls show me&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 06:05:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533128#M104907</guid>
      <dc:creator>ashikcsures</dc:creator>
      <dc:date>2022-07-05T06:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533129#M104908</link>
      <description>&lt;P&gt;The purpose of this is to create a report on Active groups with no members and roles. I navigated to 'sys_user_group' and done the following :&lt;/P&gt;
&lt;P&gt;Here i couldnt mention roles as empty. If it could be done with a related list condition, could you pls show me&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 06:09:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533129#M104908</guid>
      <dc:creator>ashikcsures</dc:creator>
      <dc:date>2022-07-05T06:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533130#M104909</link>
      <description>&lt;P&gt;Hi &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="fd33ef25db524010414eeeb5ca961934"&gt;@Kartik Sethi&lt;/SN-MENTION&gt; , Thanks for your suggestion. But I wanted to combine these two and create a report on this.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 06:12:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533130#M104909</guid>
      <dc:creator>ashikcsures</dc:creator>
      <dc:date>2022-07-05T06:12:22Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533131#M104910</link>
      <description>&lt;P&gt;add this related list condition along with &lt;STRONG&gt;active is true and group members is 0 &lt;/STRONG&gt;filter&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/31608i09E045BEC9FC6AA6/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 06:37:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533131#M104910</guid>
      <dc:creator>Voona Rohila</dc:creator>
      <dc:date>2022-07-05T06:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533132#M104911</link>
      <description>&lt;P&gt;Hello &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="00383130db6c1190fd8d2b69139619ae"&gt;@Ashik Suresh&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try something like this and call it in your report:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;getActEmptyGrps: function() {
        var arrG = [];
        var grA = new GlideRecord("sys_user_group");
        grA.addActiveQuery();
        grA.query();
        while (grA.next()) {
            var grG = new GlideAggregate("sys_user_grmember");
            grG.addQuery("group", grA.getUniqueValue());
            grG.addAggregate("COUNT");
            grG.query();
            if (grG.next()) {
                if (grG.getAggregate("COUNT") == 0) {
                    var grR = new GlideAggregate("sys_group_has_role");
                    grR.addQuery("group", grA.getUniqueValue());
                    grR.addAggregate("COUNT");
                    grR.query();
                    if (grR.next()) {
                        if (grR.getAggregate("COUNT") == 0) {
                            arrG.push(grA.getDisplayValue());
                        }
                    }
                }
            }
        }
        return arrG.toString();
    },&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In Report your filter condition would be like below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="blob:https://community.servicenow.com/87691932-7d8a-4189-b08f-29218ee3c42b" /&gt;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Murthy&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 06:45:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533132#M104911</guid>
      <dc:creator>Murthy Ch</dc:creator>
      <dc:date>2022-07-05T06:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Active groups with no members and Roles</title>
      <link>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533133#M104912</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/31615i33D9AE4779B8C3B7/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 06:47:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/active-groups-with-no-members-and-roles/m-p/533133#M104912</guid>
      <dc:creator>Murthy Ch</dc:creator>
      <dc:date>2022-07-05T06:47:47Z</dc:date>
    </item>
  </channel>
</rss>

