getRoles (DirectoryUser - JavaScript™)
Gets the directory entry's roles.
Syntax
getRoles() : java.util.List
Return value | Description |
---|---|
java.util.List |
The roles. |
Example
This computed field displays the roles of the directory entry for the current user.var roles = context.getUser().getRoles().toArray();
if(roles.length > 0) {
for(var i=0; i<roles.length; i++) {
var rolesOut = rolesOut + " " + roles[i];
}
return rolesOut
} else {
return "No roles"
}