getGroups (DirectoryUser - JavaScript)

Gets the directory entry's groups.

Syntax

getGroups() : java.util.List
Return value Description
java.util.List The groups.

Example

This computed field displays the groups of the directory entry for the current user.
var groups = context.getUser().getGroups().toArray();
if(groups.length > 0) {
	for(var i=0; i<groups.length; i++) {
		var groupsOut = groupsOut + " " + groups[i];
	}
	return groupsOut
} else {
	return "No groups"
}