Display Group Members of Child Groups

MGanon
Tera Guru

We have groups at 2 levels. Understanding that the group member tab shows the list of members of that group, we need to also display the members of children groups.

For example: Group C has members X, Y, & Z and is a child to group P. Group P has members A, B, & C. When a user opens group P, that user needs a related list showing the group C members. Ultimately, we would like a single list showing all member of the group and all children but a second tab showing just the children group members works for now.

Is this possible? If so, how?

Thanks

1 ACCEPTED SOLUTION

Nick Peters
Tera Guru

You can accomplish this by creating a new Relationship record and using it to query for group members of child groups.

Go to System Definition > Relationships and create a new record.

Name:
Child Group Members->Parent Group

Applies to table:
Group [sys_user_group]

Queries from table:
Group Member [sys_user_grmember]

Query with:

(function refineQuery(current, parent) {

	// Add your code here, such as current.addQuery(field, value);
	current.addQuery('group.parent', parent.sys_id);

})(current, parent);

Go to a group record, open the context menu, and go to Configure > Related Lists. Select the relationship record you just made. That's it! You may want to rename the related list on the form to give it a better name.

View solution in original post

13 REPLIES 13

kapoorski
Kilo Explorer

Did you ever get solution to this? I am running into same problem. 

 

Thanks

In addition to the script examples for building relationships, we added similar scripts to the calculated value of the dictionary. That allows users to select the members of children groups from a form such as a task.

Check this out and see if it helps. Its how I pull assignees from sub groups up to parent groups for assigning things. 

 

Handling Groups and Subgroups - Developer Community - Question - ServiceNow Community

Hiya... Yes we did!!

so step one.. create a business rule!

find_real_file.png

 

find_real_file.png

 

Step 2, create another business rule to remove members if they are removed from one of the child groups! Another business rule...

 

find_real_file.png

 

find_real_file.png

 

 

Within both of the business rules leave the "actions" tab blank.

 

Hope this helps you!