function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael3.BrownMichael3.Brown 

How Can I Display a User's Name Rather than His or Her ID?

Hello, I have created a VisualForce page that calls an SSQL statement and displays the records in my database. All my fields are displaying correctly, except my "Owner" field, which is a user lookup.

 

On this field, the User ID is displaying instead of the User name.

 

For example, I am seeing:

Owner

00530000004FXC5AAO

00530000004FYJJAA4

 

when I really want to be seeing

Owner

Steve Perry

Leroy Jenkins

 

 

My The object API for Owner is called: Owner__c. Do I need to attach an attribute to this in order to see the user's name rather than their ID?

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

If you use outputField it will automatically show the name instead of the id, and turn the field into a link to the lookup record (in this case the user record for owner).

 

If you don't want to use outputField, you can always access the name on the parent record, like {!myObject.owner__r.name}

All Answers

jwetzlerjwetzler

If you use outputField it will automatically show the name instead of the id, and turn the field into a link to the lookup record (in this case the user record for owner).

 

If you don't want to use outputField, you can always access the name on the parent record, like {!myObject.owner__r.name}

This was selected as the best answer
Michael3.BrownMichael3.Brown

Hey Jill,

 

Thanks for the reply. That was it! I was usin outputText instead of outputField, but it is working now.

 

Thanks!

Mike