SEL_UserRole
Class · Group: Selectors
apex
global inherited sharing class SEL_UserRole extends SEL_BaseExtends: SEL_Base
Selector for the UserRole SObject. Provides query methods for retrieving user roles and traversing the role hierarchy.
Since: 1.0
Example:
apex
UserRole role = (UserRole)new SEL_UserRole().findById(roleId);
List<UserRole> childRoles = new SEL_UserRole().findAllChildRoles(new Set<Id>{parentRoleId});See Also: SEL_Base
Methods
| Method | Description |
|---|---|
| global List findAllChildRoles(Set<Id> parentRoleIds) | Recursively finds all child roles (direct and indirect descendants) for the given parent role Ids. |
| global override List getFields() | Returns the core fields for UserRole queries. |
| global SEL_UserRole() | Constructs a UserRole selector. |
Method Details
SEL_UserRole
apex
global SEL_UserRole()Constructs a UserRole selector.
Since: 1.0
Example:
apex
SEL_UserRole instance = new SEL_UserRole();findAllChildRoles
apex
global List<UserRole> findAllChildRoles(Set<Id> parentRoleIds)Recursively finds all child roles (direct and indirect descendants) for the given parent role Ids. Useful for determining the full role hierarchy beneath one or more starting roles.
Parameters:
parentRoleIds(Set) - Set of starting parent UserRole Ids
Returns: UserRole - List of all descendant UserRole records (excluding the original parent roles)
Since: 1.0
Example:
apex
List<UserRole> result = instance.findAllChildRoles(recordIds);getFields
apex
global override List<SObjectField> getFields()Returns the core fields for UserRole queries.
Returns: SObjectField - List of UserRole SObjectField tokens
Since: 1.0
Example:
apex
List<SObjectField> result = instance.getFields();