ServiceNow: System Maintenance

Groups - no members


var grGroups= new GlideRecord('sys_user_group');
grGroups.addActiveQuery();
grGroups.query();
var iCounter=0;
gs.print('**START: total active groups is ' + grGroups.getRowCount());
while (grGroups.next()){

    var grGrpMemb=new GlideRecord('sys_user_grmember');
    if (!grGrpMemb.get('group', grGroups.sys_id)){
       gs.print(grGroups.name + ' has no members, please check');
       iCounter++;
    }
}

gs.print('**END: ' + iCounter + ' groups have no members');

Comments

  1. You have shared amazing post. This post is really helpful for us to know the information. Thank you for taking your time to post such a wonderful article. Get for more information Porsche Car garage in Dubai

    ReplyDelete

Post a Comment

Popular posts from this blog

GlideRecord setValue

variable advanced reference qualifier example

URL link in addInfoMessage