You need to sign in to do that
Don't have an account?
Pawan Kumar 32
Create a Visualforce page that shows user information
Hello All,
I am stuck in below trailhead chanllange
Create a Visualforce page that displays the first name of the logged-in user.
<apex:page>
{!$User.FirstName } {!$User.LastName } ({!$User.Username })
</apex:page>
I am stuck in below trailhead chanllange
Create a Visualforce page that displays the first name of the logged-in user.
- The page must be named 'DisplayUserInfo'.
- The displayed user information must be generated dynamically from the logged-in user.
<apex:page>
{!$User.FirstName } {!$User.LastName } ({!$User.Username })
</apex:page>
All Answers
I am also getting the same error while trying it in developer edition?
<apex:page>
<apex:pageblock>
<apex:pageblockSection>
{!$user.firstname}
</apex:pageblockSection>
</apex:pageblock>
</apex:page>
As i could check your code, you have used global variable $User to print Username as well... So just remove ({!$User.Username }) and Print only first name or you can print both (firstname and lastname).
Working code is:
<apex:page >
{! $User.FirstName }
</apex:page>
<apex : page>
{! $User.FirstName}
</apex: page>
<apex:pageBlock title="User Status">
<apex:pageBlockSection columns="1">
{! $User.FirstName } {! $User.LastName } ({! $User.Username })
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Try to use this code you will pass the trailhead task.
<apex:page>
<apex:pageBlock title="User Status Info">
<apex:pageBlockSection columns="1">
{! $User.FirstName}
({! IF($User.isActive, $User.FirstName, 'inactive') })
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
{! $User.FirstName}
{! $User.LastName }
{! $User.Username }
</apex:page>