You need to sign in to do that
Don't have an account?

output list from a SOQL sub-query
Hi there,
I'm trying to list all direct reports for the logged in User using User and UserRole.
I'm querying the UserRole tables ParentRoleID field to find any children of the parent, then going back to the User table to find the users login id.
Here is my controller:
Code:
public class FindReports { public List<UserRole> getMyRoles() { //return [Select u.UserRole.Name, u.UserRole.Id, u.UserRoleId, u.Alias From User u WHERE u.UserRoleId != null LIMIT 10]; return [Select u.Name, u.Id, (SELECT Alias FROM Users) From UserRole u WHERE u.ParentRoleId = :UserInfo.getUserRoleId()]; } }
I can't seem to access the "Alias" from the Users object in my VisualForce code:
Code:
<apex:page Controller="FindReports" tabStyle="Account"> <apex:pageBlock title="My Reports Roles"> <apex:dataTable value="{!myRoles}" var="aRole" cellpadding="2" rowClasses="odd,even" styleClass="tableClass"> <apex:column > <apex:facet name="header"><b>Role Name</b></apex:facet> {!aRole.Name} </apex:column> <apex:column > <apex:facet name="header"><b>Role ID</b></apex:facet> {!aRole.Id} </apex:column> <apex:column > <apex:facet name="header"><b>User 6+2</b></apex:facet> <!-- {!aRole.Users.Alias} --> </apex:column> </apex:dataTable> </apex:pageBlock> </apex:page>
I can't find "Alias" in the returned Object: java.util.ArrayList does not have the property "Alias".
Thank you!
Hi Jill,
I actually read that thread 3 times before I posted, but I do want the entire list of names.
Is it a matter of moving the object name (aRole) from the page to the controller?