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
kazumikazumi 

Page access error in Quick Start Tutorial

I tryed Visualforce Quick Start Tutorial, but it was not work on section "Displaying Field Values on a Page".
<apex: page standardController="Account">
    Hello {!$User.FirstName}!
    <p>You are viewing the {!account.name} account.</p>
</apex: page>
I could not get result page from below URL access.
https://na5.salesforce.com/apex/HelloWorld?id=00570000001EOx5
I got "00570000001EOx5" from URL of my personal information page as described Tutorial, but error occured.

How can I solve this problem ?

Thanks,
Kazumi
caroline_sfdccaroline_sfdc
Hi Kazumi,

For the URL you need to grab an ID for an account record, and not the user record that displays when you click on your personal information in setup.

To find the ID for an account, navigate to the Accounts tab, click on an account to show its detail page, and then grab the ID off the URL. You'll know you have a good one if it starts with 001, which is the prefix for all account IDs (005 is the prefix for all user IDs).

The reason you need an account ID, and not a user ID, is because {!$User.FirstName} in the markup is actually accessing a global variable called $User -- this global always matches the record for the user who is currently logged in (you!). Global variables always start with a $ character, and they don't need an ID specified in the URL.

Later in the code is the variable that _does_ need an ID in the URL: {!account.name}. Since there are probably a lot of account records in your organization, you have to specify the exact one that should provide the values for the page with an ID.

Hope that answers your question and gets your page working the way you expect!

Caroline Roth
Manager, Platform Documentation
salesforce.com


dchasmandchasman
... and it looks like you have a syntax issue also according to the example markup you posted - it looks like you have whitespace between the tag namespace alias (apex) and the tag name (page) and this is incorrect, should be apex:page. All apex tags and custom component tags must not have embedded whitespace, basically the namespace alias and the name separated by a colon make up the tag name. Without the prefix we have no way to separate the visualforce parts of the page from static content...
kazumikazumi
Hi Caroline,

Thank you for your very quick answer !
I unserstand difference between user id and account id, and I have made sure account information page are working well.

I had confused user and account because "Account" is translated to Japanes word (TORIHIKISAKI) in my environment.

Thank you so much,
Kazumi
kazumikazumi
Hi Doug,

Thank you for your point.
I eliminate white space between apex tag and name.

Thanks,
Kazumi.
VPatilVPatil

Hi,

I am trying the same example and has correct account id ( starting from 001) in URL and has no space in the apex:page tag. But my output displays as

 Hello World!

You are viewing the account.

 
Why do I not see the name of the account?