You need to sign in to do that
Don't have an account?
Displaying a user's account name in a visualforce page
I am racking my brain trying to do something very simple in a visualforce page. I am displaying a SWF file and trying display and pass the current User's account name into the SWF. My problem is capturing the current user's account name for some reason. When I run it I get no errors and the SWF renders exactly as I expect, but when I am logged in as any user, I can not get it to display the account name. By all accounts, I assume I thought that the code below would bring back the current user's account name but I get nothing right now.
{!User.Contact.Account.Name}
Any ideas would be much appreciated. I am definitely not an expert in this area but was hoping that I could put this very basic functionality together without a major effort. Thank you.
<apex:page standardController="User" sidebar="false" showheader="true"> <apex:flash src="{!$Resource.mapsusage}?cscustomer={!User.Contact.Account.Name}" height="315" width="710" /> {!User.Contact.Account.Name} </apex:page>
Did you try {!$User.Contact.Account.Name}
Greatly appreciate the suggestion. {!$User.Contact.Account.Name} resulted in the following error when I swapped it out:
Error: Field Contact.Account.Name does not exist. Check spelling.
you can't access user account name in this way.
You have to do it in following way.
1. create custom controller and fetch account name in controller constructor. assign account name value to any variable.
2. access that variable in your URL
try using
{!$User.Contact.Account}