+ Start a Discussion
SARANG DESHPANDESARANG DESHPANDE 

Create a Visualforce page which shows a list of Accounts linked to their record pages

I was solving this challenge and my VF code is:

<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageblock>
        <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
            <li>
                <apex:outputLink value="https://ap1.salesforce.com/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>

I am getting the list of accounts as required and on clicking on any of the accouts, it redirects to that accounts detail page.
Still I am getting following error from trailhead:

"The page does not bind to the record ID value (in order to link to the record detail page)"
Best Answer chosen by SARANG DESHPANDE
Amit Chaudhary 8Amit Chaudhary 8
Please try below code:-
 
<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageblock>
        <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
            <li>
                <apex:outputLink value="/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>
Please let us know if this will help u
 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below code:-
 
<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageblock>
        <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
            <li>
                <apex:outputLink value="/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>
Please let us know if this will help u
 
This was selected as the best answer
SARANG DESHPANDESARANG DESHPANDE
<apex:outputLink value="/{!a.ID}" > instead of <apex:outputLink value="https://ap1.salesforce.com/{!a.ID}" > worked. Thanks!
gary chen.gary chen.
I am also getting this error , who can help me
Abhinav SinghAbhinav Singh
Hi
The above code is not working for me. I am getting a blank screen.Blank Screen
Amit Chaudhary 8Amit Chaudhary 8
Hi Abhinav,

Can you please check you have any account record in your org ?
Abhinav SinghAbhinav Singh
Yes. I have account records in the org.
User-added image
Amit Chaudhary 8Amit Chaudhary 8
if you want i can lookinto your org what is the issue because same code is working fine for me. feel free to connect with me on my email id amit.salesforce21@gmail.com
Abhinav SinghAbhinav Singh
Sure. I just sent you an invite.
Abhinav SinghAbhinav Singh
Same code is working fine now
Deepak MahapatraDeepak Mahapatra
Hi 

The above code is not working for me. First when I do Preview, no Account record appears, secondly when I try to Verify the Challenge, its gives the error "The page does not bind to the record ID value (in order to link to the record detail page)". I don't understand what is the issue here.. 

Could anybody please help me. 

Thanks
Deepak
Rajeshwar PatelRajeshwar Patel
I m also getting a blank screen ???
Jon SkinnerJon Skinner
I have also had the same problem as the original poster - derived almost identical code, and got the same error when I checked the challenge - mainly due to the 'hint' provided in the challenge instructions.  I think it's a bit mean of them to provide hints that are actually red herrings.
I'm still not clear why our solutions, which appears to provide working results that meet the instructions, is unacceptable.
Jayapriya SomuJayapriya Somu
Hi Artem,
How are you testing this? When you click on preview, is it displaying the list of accounts ?When I use the same code and click preview, I could see only a blank page. Please clarify. Thanks
Artem KalusArtem Kalus
To be honest I do not remember if I could see the list of accounts.
Sudheer Reddy Vangala 22Sudheer Reddy Vangala 22
I am getting a blank screen if i don't pass any account record id to the page. Something is wrong with salesforce :(
I don't know what is the difference between two below statements.
<li>  <apex:outputLink value="/{!a.Id}" id="theLink">{!a.Name}</apex:outputLink> <br></br> </li> 
or
<li>  <apex:outputLink value="https://c.na35.visual.force.com/{!a.Id}" id="theLink">{!a.Name}</apex:outputLink> <br></br> </li> 

both are fine, but to pass the challenge we have to use the first one, that's strange.
Krishna GokarajuKrishna Gokaraju
Challenge Not yet complete... here's what's wrong: 
The page 'AccountList' was not found.

Below is code which seems correct but im getting the above error. Do i need to change any permission settings?

<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageblock >
        <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
            <li>
                <apex:outputLink value="/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>
 
Amit Chaudhary 8Amit Chaudhary 8
Please delete the same class and recreate the same Vf page from below step
Setup--> Visualforce pages.
 
raushan kumar 34raushan kumar 34
use this code: 
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock>
    <apex:repeat value="{!accounts}" var="a">
        <li>
            <apex:outputLink value="/{!a.ID}">
                <apex:outputText value="{!a.name}"/>
            </apex:outputLink>
        </li>
        </apex:repeat>  
    </apex:pageBlock>
</apex:page>
raushan kumar 34raushan kumar 34
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock>
        
    <apex:repeat value="{!accounts}" var="a">
        <li>
            <apex:outputLink value="/{!a.ID}">
                <apex:outputText value="{!a.name}"/>
            </apex:outputLink>
        </li>
        </apex:repeat>
            
    </apex:pageBlock>
</apex:page>

 
TaylorOTaylorO
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock>
        <apex:pageBlockSection>
            <apex:repeat value="{!accounts}" var="a">
            	<li>
                    <apex:outputLink value="/{!a.ID}">
                    	<apex:outputText value="{!a.name}"/>
                    </apex:outputLink>
                </li>
            </apex:repeat>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

This worked for me
Charles ThompsonCharles Thompson
There appears to be a common problem with blank pages where there should be data.  Can someone offer some advice on this?

A little research shows that if you go straight to buiding a page as above, then preview that page, it commonly shows only a blank page.  Then you go to the normal standard page for that object (Account) - this brings up the Recent list view.  Just go back to the page you built and refresh - Voila!  The results from the Recent list view now appear.  Go back to the Account page, and select the All Accounts list view, then go back to your VF page.  Again - you see a different result - now you get all accounts.

So does someone know why this happens?  It appears to be a function of the standard list controllers.  Is it reusing a cache when displaying list values in the above code?
Stuart McClainStuart McClain
I am having the exact same erros/scenarios - I get the list after refreshing the actual list page as described - but getting the error message that it didnt BIND.
Rahul Sinha 23Rahul Sinha 23
This code will work definitely : 
 
<apex:page standardController="Account" recordSetVar="accounts" >
    <br/><br/>
    <apex:pageBlock title="Account Records">
        <apex:form >
    		<apex:pageBlockTable value="{!accounts}" var="acc">
                <apex:column value="{!acc.Name}"/>
                <apex:column value="{!acc.AccountNumber}" />
                <apex:column value="{!acc.Phone}"/>
                <apex:column value="{!acc.Industry}"/>
                <apex:column value="{!acc.Type}" />
        	</apex:pageBlockTable>
        </apex:form>
    </apex:pageBlock>
</apex:page>

 
Artem Kalus 7Artem Kalus 7
Administrator, please delete this user (​userId=0050G000007lvio). I connot login and keep receiving emails from this discussion.
Jim StevensJim Stevens
In order to see any accounts listed, you must append the URL of your preview page with &id=0011I000005sX4XQAU, where 0011I000005sX4XQAU is an actual account Id from your org [you will need to replace 0011I000005sX4XQAU with an id from your org.]  To locate a valid Account ID, go to the Accounts page of the org you are working with [development, sandbox, Trailhead development, whatever], click on an Account, then copy the ID from the page's URL and paste to the Preview page.  Press Enter to refresh the page and a list of accounts will appear.
Krishnan MishraKrishnan Mishra
Salesforce is acting a little weird here, my code:
<apex:page standardController="Account" recordSetVar="acc">
<apex:repeat value="{!acc}" var="a" rendered="true">
   <apex:outputField value="{!a.name}"/><br/>
</apex:repeat>
</apex:page>

This was working all right few hours back but now it is showing a blank page,i did'nt made any changes to the code or to my org.Also the same code is working on a different machine perfectly fine.
PS: If i pass record id in the address bar then it works perfectly fine
 
BINOY MATHEWBINOY MATHEW
Guys- Please check Jim Stevens reply to this thread. It worked for me! I was having the same blank page on preview but the Challenge passed with blank page- which is funny. 

In one of the previous units you learned how to copy the ID from the URL of an actual account in your Dev instance. Please do the same for this and it works. Please check Jim's answer for details.

@Jim Stevens and Amit Chaudhary and others who've offered valuable help. Saved a lot of headache and time. 
Dave WickardDave Wickard
Blank page was successful for the Challenge here as well.
Ken Ke 7Ken Ke 7
In order to pass the challenge, I need to put /{!a.ID} as the value of the outputLink, yet /lightning/r/Account/{!a.ID}/view is the one actually allowed me to access the account record by cliking the link however it failed the challenge.
kora bornkora born
I did exactly as in the trail and Jim's response here, my URL with:

https://XXXve-moose-194704-dev-ed--c.na59.visual.force.com/apex/AccountSummary?core.apexpages.request.devconsole=1&id=001j000000DqtjbAB

does absolutely nothing. Just shows the previously loaded preview page. Even I removed a digit in the account id to ssee if it fails at least this time, but same difference.
kora bornkora born
I also get this blank results when I try the next few lines:

In my code, I have:

<apex:page standardController="Account">
                
Name: {! Account.Name } <br/>
Phone: {! Account.Phone } <br/>
Industry: {! Account.Industry } <br/>
Revenue: {! Account.AnnualRevenue } <br/>
    
</apex:page>In the preview, what I see is just:

Name: 
Phone: 
Industry: 
Revenue: 

I checked in the main Account details page I have all that info filled (Account: Dickenson plc)
kora bornkora born
User.* prints properly.
Stephen F. MurrayStephen F. Murray
Please help!

I am using the following code, and the challenge displays "Challenge not yet complete... here's what's wrong:
The page component does not include the Account standard controller."


<apex:page standardController="Account" recordSetVar="accounts" >
    <br/><br/>
    <apex:pageBlock title="Account Records">
        <apex:form >
            <apex:pageBlockTable value="{!accounts}" var="acc">
                <apex:column value="{!acc.Name}"/>
                <apex:column value="{!acc.AccountNumber}" />
                <apex:column value="{!acc.Phone}"/>
                <apex:column value="{!acc.Industry}"/>
                <apex:column value="{!acc.Type}" />
            </apex:pageBlockTable>
        </apex:form>
    </apex:pageBlock>
</apex:page>
Anil GiriAnil Giri
Hi Murray,
You have to create link for all accounts with its name.
use following code and try once.

<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:pageblock>
        <apex:repeat  id="accountListId" var="acc" value="{!Accounts}" rendered="true" >
            <li>
                <apex:outputLink value="/{!acc.ID}" >
                    <apex:outputText value="{!acc.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>
Naveen MosuruNaveen Mosuru
Hello guys,
My code is working fine as explained by our Experts. When we preview our page it is showing a blank page, Right! But have you noticed when we go to our org's Accounts page and come back to visual force page it is showing the list? Have a try. I don't know the reason behind this, anyone's explanation is appreciated.

<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:slds/>
    <apex:form>
        <apex:pageblock title="Accounts List">
            <apex:repeat var="a" value="{!Accounts}" rendered="true" id="account_list">
                <li>
                    <apex:outputLink value="/{!a.ID}" >
                        <apex:outputText value="{!a.Name}"/> <br/>
                        <apex:outputText value="{!a.AccountNumber}"/>
                    </apex:outputLink>
                </li>
            </apex:repeat>
        </apex:pageblock>
    </apex:form>
</apex:page>
kora bornkora born
I have been looking high and low for an unsubscribe button, as I have given up on SFCC after I hit this blocker and no one can help.
How do I unsubscribe from this thread ? Thanks
Artem Kalus 7Artem Kalus 7
Administrator, please delete this user (​userId=0050G000007lvio). I cannot login and keep receiving emails from this discussion.
Ketan TrivediKetan Trivedi
I am still getting error - Challenge not yet complete... here's what's wrong:
The page does not bind to the record ID value (in order to link to the record detail page)

Also I was not getting the detail page upon clicking the Account Name on the bulleted list. I changed the following in my code.
<apex:outputLink value="https://URcompanyordeveloperOrg.lightning.force.com/lightning/r/Account/{!a.ID}/view" >. See the word 'view' added at the end.

 
Ang Maria RufinaAng Maria Rufina
In your De Org, kindly click on Accounts Tab and view all accounts prior to "Preview" button in visualforce page codes.  I had same issue as all of you where only my recently viewed Account is showing.

To ensure that the code works, I added the filter and I was able to complete the challenge

Here is my codes:
<apex:page standardController="Account" recordSetVar="Accounts" >
    <apex:form>
    <apex:pageblock>
        <apex:repeat var="a" value="{!Accounts}" rendered="true" id="accountListId">
            
            Filter: 
        <apex:selectList value="{! filterId }" size="1">
            <apex:selectOptions value="{! listViewOptions }"/>
            <apex:actionSupport event="onchange" reRender="accountListId"/>
        </apex:selectList>
            
            
            <li>
                <apex:outputLink value="/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
        </apex:form>
</apex:page>
 
Sandip PanchaniSandip Panchani
If you still show blank page, Create new Account and see again. Definitely you will get account list. Reason of show blank is that you have created VF page in your Trailhead Playground and There are no any Accounts. I have faced same issue and Then resolve it after create new account record.
hansa sabbarwalhansa sabbarwal

Hi All , 

I also had the same issue but it gets resolved after when I Clicked on Standard Account list view and changed its Filter to All Accounts it worked!!! I refreshed my page and its showing all accounts now.

Here is my code :

<apex:page standardController="Account" recordSetVar="accounts" >
    <apex:pageblock >
        <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
            <li>
                <apex:outputLink value="/{!a.ID}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>

Please use it as your reference if you also find the same issue in your org.

Thanks

Noman SaeedNoman Saeed
Issue resolved and trail challange has been passed succesfully.
We have to add id property and bind id in value as mentioned below,

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Account List">
        <!--Accounts List-->
        <apex:repeat value="{! accounts}" var="a" rendered="true" id="account_list">
            <!--
            <apex:pageBlockSection title="{! a.Name }">
                <apex:pageBlockTable value="{! a.contacts }" var="con">
                    <apex:column value="{! con.Title }"/>
                    <apex:column value="{! con.FirstName }"/>
                    <apex:column value="{! con.LastName }"/>
                    <apex:column value="{! con.Email }"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            -->
            <li>
                <apex:outputLink value="/{! a.ID}" id="recordID">
                    <apex:outputText value="{! a.Name }" />
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>
Palash Rana 8Palash Rana 8
You can solve this proble by      

 <apex:outputLink value="/{!a.id}" >                                      //Get your ID by going to App Manager->Account->Select any record ->Select the                                                                                                            id from URL(i.e.  0012v00002J7ROvAAN)-->then paste your ID on challenge                                                                                                                precedded by &id= which wil look like (&id=0012v00002J7ROvAAN)

This will give the records
 
Mareeswaran RMareeswaran R
Can somebody explain this?