Assuming its the owner you want to display, SOQL relationship queries allow several levels of parent object to be queried at once. So you can add the objects and fields your require to the query by using the parent object relationship names:
theBusinessUnit = [
select Id, Name, Sharing_Group_Name__c, Read_Write_Access_to_Child_BUs__c,
Owner.Name, Owner.Profile.Name
from grc__Business_Unit__c
order by Name
limit 50000
];
and then display the values by adding more columns in the Visualforce:
<apex:column headerValue="User" value="{!dbItem.Owner.Name}"/>
<apex:column headerValue="Profile" value="{!dbItem.Owner.Profile.Name}"/>
Basically what you are asking about, it is called as dependent\controlling picklist fields, you need to specify on field definition level that second picklist is dependent and select values available for each values of controlling field.
So you may use either apex:inputField or apex:selectList.
If you want to allow users to select several values at a time you may set multiselect="true"
UPD.
You have the same name for two methods, you need have different method names.
You may use something like this
<apex:actionRegion >
<apex:selectList value="{!controllingField}">
<apex:selectOptions value="{!contFieldOptions}"/>
<apex:actionsupport event="onchange" rerender="depFieldParent" />
</apex:selectList>
</apex:actionRegion>
<apex:outputPanel id="depFieldParent">
<apex:selectList value="{!dependentField}">
<apex:selectOptions value="{!depFieldOptions}"/>
</apex:selectList>
</apex:outputPanel>
In the controller you may add more logic like this
public List<SelectOption> getDepFieldOptions() {
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult departfield = Activity_Tracker__c.SubCust__c.getDescribe();
List<Schema.PicklistEntry> picklist = departfield.getPicklistValues();
for( Schema.PicklistEntry f : picklist){
if ( controllingField != null ) { // you may want to add more logic here
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
}
return options;
}
UPD:
You may still use your unaltered version of getDept() method as getContFieldOptions to retrieve option for controller field:
public List<SelectOption> getContFieldOptions() {
List<SelectOption> options = new List<SelectOption>();
Schema.DescribeFieldResult departfield = Activity_Tracker__c.Category__c.getDescribe();
List<Schema.PicklistEntry> picklist = departfield.getPicklistValues();
for( Schema.PicklistEntry f : picklist){
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}
Best Answer
You have to write a small Apex method that returns a list of users. And then implement a small pageblock table on the Visualforce page to display that list.
Apex:
Visualforce:
The result:
Here you can find a complete list with all user object fields