I have a visualforce component which I use for displaying the user's name. Currently I am doing it using the following:
!$User.FirstName} {!$User.LastName}
Is there any way I can display the User's Account as well using this without writing SOQL. I would not like to create a controller just to display the user's account and am hoping there is a simpler and easier way using just Visual force.
I did try !$User.Contact.Account}
But it gave me an error.
Thanks.
Here are two things you may want to try:
Reference the Account Name from the $User Visualforce global variable.
{!$User.Contact.Account.Name}
If that doesn't work, create a new formula field on the User object named Contact Account Name
with this formula: Contact.Account.Name
. Once you have created that formula field, you should be able to reference it in Visualforce using: {!$User.Contact_Account_Name__c}
.