You need to sign in to do that
Don't have an account?
Andrea Sloan
User list view in VisualForce
I am trying to create a VisualForce page for our Trainer who requires visibility of a few fields from the user object but she does not have permissions to enter hte user objct and perform edits. I'm not sure how to create this page and need some help. With what I've tried, when I hit the preview icon I only get information returned related to the one custom fild I've inserted in my VisualForce coding. The two standard fields don't return antying. I should ideally have a populated list with such information for all my users and not just one (unless the view mode will only show one?)The other fields don't return anything. Below is my coding and attached is a screenshot of what it retruns.
<apex:page standardcontroller="User " >
<apex:pageBlock>
<apex:pageBlockTable value="{!User}" var="user">
<apex:column headerValue="Name">
{!user.FirstName} {!user.LastName}
</apex:column>
<apex:column headerValue="Time Zone ">
{!user.TimeZoneSidKey}
</apex:column>
<apex:column headerValue="Account Owner ">
{!user.Account_Owner__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
<apex:page standardcontroller="User " >
<apex:pageBlock>
<apex:pageBlockTable value="{!User}" var="user">
<apex:column headerValue="Name">
{!user.FirstName} {!user.LastName}
</apex:column>
<apex:column headerValue="Time Zone ">
{!user.TimeZoneSidKey}
</apex:column>
<apex:column headerValue="Account Owner ">
{!user.Account_Owner__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
I actually figured it out. The correct coding was missing a recordSetVar in order to capture the complete set of user records within the object. I'm listing the correct answer below. Thank you for giving it a shot!
<apex:page standardcontroller="User" recordSetvar="Users">
<apex:pageBlock title="List of Users">
<apex:pageBlockTable value="{!Users}" var="listofusers" >
<apex:column headerValue="Name">
{!listofusers.Full_Name__c}
</apex:column>
<apex:column headerValue="Office">
{!listofusers.UserRegionalClassification__c}
</apex:column>
<apex:column headerValue="Profile">
{!listofusers.Profile}
</apex:column>
<apex:column headerValue="Time Zone ">
{!listofusers.TimeZoneSidKey}
</apex:column>
<apex:column headerValue="Email Address ">
{!listofusers.Email}
</apex:column>
<apex:column headerValue="Account Owner ">
{!listofusers.Account_Owner__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
All Answers
I'm pretty new to apex, but try something like this,
<apex:pageBlock>
<apex:pageBlockTable value="{!User}" var="user">
<apex:column value="{!user.FirstName}" />
<apex:column value="{!user.LastName}" />
<apex:column value="{!user.LastName}" />
<apex:column value="{!user.TimeZoneSidKey}" />
<apex:column style="width:400px; height:15px;" value="{!user.Account_Owner__c}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
I actually figured it out. The correct coding was missing a recordSetVar in order to capture the complete set of user records within the object. I'm listing the correct answer below. Thank you for giving it a shot!
<apex:page standardcontroller="User" recordSetvar="Users">
<apex:pageBlock title="List of Users">
<apex:pageBlockTable value="{!Users}" var="listofusers" >
<apex:column headerValue="Name">
{!listofusers.Full_Name__c}
</apex:column>
<apex:column headerValue="Office">
{!listofusers.UserRegionalClassification__c}
</apex:column>
<apex:column headerValue="Profile">
{!listofusers.Profile}
</apex:column>
<apex:column headerValue="Time Zone ">
{!listofusers.TimeZoneSidKey}
</apex:column>
<apex:column headerValue="Email Address ">
{!listofusers.Email}
</apex:column>
<apex:column headerValue="Account Owner ">
{!listofusers.Account_Owner__c}
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>