You need to sign in to do that
Don't have an account?
NIyathi
Find the SubRoles for the Role Id and the users under each Sub Role for the entered Role Id on page
Hello,
I have a requirement like this.
Create a Visualforce page:
Enter Role Id: [Input Field]
"Go" button
User enters a RoleId, and clicks on Go button. This will display the Sub Ordinate role Ids under the Role Id that was entered in the page. And the Users that are under each SubOrdinate Role.
Roles:
RoleId1
UserId1
UserId2
RoleId2
UserId1
UserId2
RoleId3
UserId1
UserId2
Please helpme on this.
Thanks,
Niyathi
I have a requirement like this.
Create a Visualforce page:
Enter Role Id: [Input Field]
"Go" button
User enters a RoleId, and clicks on Go button. This will display the Sub Ordinate role Ids under the Role Id that was entered in the page. And the Users that are under each SubOrdinate Role.
Roles:
RoleId1
UserId1
UserId2
RoleId2
UserId1
UserId2
RoleId3
UserId1
UserId2
Please helpme on this.
Thanks,
Niyathi
List<UserRole> childRoles = [select id from UserRole where ParentRoleId = :typedRole];
so you have all child roles, now to get users:
List<User> users = [select id, ..., UserRoleId from User where UserRoleId in :childRoles];
now simple make map UserRoleId->User and you have all you need. But if you want all sub roles tree then you need to go with DSF alghoritm using those selects