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
Andy HoyingAndy Hoying 

Challenge: Using Standard List Controllers - Error Message

Trying to complete this challenge.  Recieve the following error message.  Need help resolving:

"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)"

Here's my code for 'AccountList.vfp':

<apex:page standardController="Account" recordSetVar="accounts">
    <table border="1" >
  
        <apex:repeat var="a" value="{!Account}">
            <li>
                <apex:outputLink value="/<record id>">
                    Record
                </apex:outputLink>
            </li>
        </apex:repeat>
            
    </table>
</apex:page>
Best Answer chosen by Andy Hoying
Amit Chaudhary 8Amit Chaudhary 8
Hi Andy,

Please try below code. I hope that will help you
<apex:page standardController="Account" recordSetVar="accounts">
        <apex:repeat var="a" value="{!accounts}">
            <li>
                <apex:outputLink value="/{!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
        </apex:repeat>

</apex:page>

Please let us know if that will help you

Thanks
AMit Chaudhary

All Answers

Andy HoyingAndy Hoying
Hi Amit,

Challenge requires use of <li> tag and <apex:outputlink> component.  Your example class does not use either.  Your example does resolve binding error with record ID.  Any thoughts?

Andy
Amit Chaudhary 8Amit Chaudhary 8
Hi Andy,

Please try below code. I hope that will help you
<apex:page standardController="Account" recordSetVar="accounts">
        <apex:repeat var="a" value="{!accounts}">
            <li>
                <apex:outputLink value="/{!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
        </apex:repeat>

</apex:page>

Please let us know if that will help you

Thanks
AMit Chaudhary
This was selected as the best answer
Andy HoyingAndy Hoying
Thanks Amit, that worked.  
Shobit GuptaShobit Gupta
Hi Amit,

You have used '/' in the line  <apex:outputLink value="/{!a.id}" >. When I remove it, I am getting a Visualforce error. 

Can you please let me know the reson? Thanks for help!!

-Shobit
Amit Chaudhary 8Amit Chaudhary 8
Yes you need to add /

Like below line
<apex:outputLink value="/{!a.id}" >

Please let me know if you need any more help
 
mahesh gadimahesh gadi
Hi Amith,
Can plz tell me how to complete this challenge using <apex:dataList>?
Don Heninger 11Don Heninger 11
I am having an interesting problem with this challenge.  I have done all variations of this code and I get a blank page, nothing, nada, zilch.

No error, nothing.
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:repeat var="a" value="{!accounts}">
        <li>
            <apex:outputLink value="/{!a.id}" >
                    {!a.name}
            </apex:outputLink>
        </li>
    </apex:repeat>
</apex:page>

And this:
 
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Accounts">
        <apex:repeat var="a" value="{!accounts}">
            <li>
                <apex:outputLink value="/{!a.id}">{!a.Name}</apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>

Anyone have an idea?  I have tried deleting the page and redoing it from scratch.
I have done some variation using pageBlockTable similare to the contact list view example and still not thing.
 
Dima GoncharovDima Goncharov
It is very strange indeed. So the following code compiles but does not display ANYTHING and the challenge goes through! Any thoughts?

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock >    
        <apex:repeat var="a" value="{!accounts}" >
            <li><apex:outputLink value="/{!a.id}">{!a.Name}</apex:outputLink></li>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>
Alan Jackson 12Alan Jackson 12

Dimitri - that code gives me the same output as I get from other examples in this page. Do you have data in your org?

The reason I ended up searching this was that I have the <li> as:

      <apex:outputLink value="{! '/' + a.Id }">{!a.Name}</apex:outputLink>

It produced the correct output but failed the challenge
Would be interested to hear if anyone can explain the difference to :
   
    <apex:outputLink value="/{!a.Id }">{!a.Name}</apex:outputLink>
 

Don SedberryDon Sedberry
Using a previous exercise in the unit - I thought the link might be "URLFOR($Action.Account.Edit, a.Id) " which produces the correct results as well. However - it will not validate the challenge as completed. Submitting this one to SF for review.
david roberts UKdavid roberts UK
I had the same error message because I put the full path in the URL instead of just "/{!a.id}"
"https://eu6.salesforce.com/{!a.id}"
my links worked from the page but the Challenge wanted the simpler version. Fair enough.
Thanks to all for this thread. 
shashikant pandeyshashikant pandey
Use the below code, it will work.
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:repeat var="a" value="{!accounts}">
    <li><apex:outputLink value="/{!a.id}">{!a.Name}<record id="account"></record></apex:outputLink>    </li>
    </apex:repeat>
    
</apex:page>


Thanks
Jonathan LittleJonathan Little
I also failed because I had 

<apex:page standardController="Account" recordSetVar="accounts">
     <apex:repeat   var="a" value="{!Accounts}">
     <li><apex:outputLink value="https://ue11.saleforce.com/{!a.id}"> {!a.name}
         </apex:outputLink></li>
     </apex:repeat>
</apex:page>

which also worked but failed the test. :-(
 
Amit Chaudhary 8Amit Chaudhary 8
Hi Jonathan ,

Please try below line
<apex:outputLink value="/{!a.id}" >
Problem in your code is that you are adding baseURL "https://ue11.saleforce.com" which is good for your org only. Same code will not work in other server.

 
Salesforce AnswersSalesforce Answers
This video shows the solution to this challenge. ===> https://www.youtube.com/watch?v=tU-4apYjnG4

- Salesforce Answers
Krishna Kumar 148Krishna Kumar 148
Thanks. Your Solution worked.. Could you explain the following ? The code is not listing records during the preview on my app environment

Second why trial head is unable to validate a possible correct answer with the absolute URL.

I am using the full URL as the value param:

<apex:page standardController="Account" recordSetVar="accounts">
<apex:repeat value="{!Account}" var="a" >
  <li> 
 <apex:outputLink value="https://ap1.salesforce.com/{!a.Id}"> {!a.Name}  </apex:outputLink>
 </li> 
</apex:repeat>
   
</apex:page>
Pervaz AllaudinPervaz Allaudin
I used Amit Chaudries code it worked.
My problem is, I stil cnnot tell the difference between mine and his.
Not starkdiffernces - It seems to have a mid f it's own.
The not binding might have smethig to do with login on SF expring maybe?
Any thoughts 
Pervaz AllaudinPervaz Allaudin
OK - sorry my bad.
I had the exclamation mark miissing for the value in the output liink.
Saurabh Soni 11Saurabh Soni 11
If Account list is not showing on preview page, then make sure View option selected All Accounts
Priya SubbaramanPriya Subbaraman
Thank you, Amit! Your solution helped me to complete this assignment on Standard List Controllers.
Ryan Smith 79Ryan Smith 79
Thank you Saurabh Soni 11. I was wondering why I was not seeing anything on my page when my code was the exact same. If you can't see any accounts, open a new page and go to the accounts section and select "All Accounts".
Renan Rocha | A!Renan Rocha | A!
Thanks Amit Chaudhary 8, i was trying with {!'/' + a.Id} and then i changed to /{!a.Id} and it worked.
Gordon CaisterGordon Caister
For those struggling with not seeing any results even with correct code. Adding the filter from the lesson and filtering by "all" might solve your problem. 
<apex:pageBlock title="Accounts Something" id="accounts_something">
                        Filter: 
            <apex:selectList value="{! filterId }" size="1">
                <apex:selectOptions value="{! listViewOptions }"/>
                <apex:actionSupport event="onchange" reRender="accounts_something"/>
            </apex:selectList>
        	<apex:pageBlockSection >

I don't know if this is a bad hack, but it's the only way I could get non-operational but otherwise correct code to work. 
harish kpharish kp

Getting the same 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)]
  while using root URL as given,But working as expected. Is there anything wrong in conventions? 

User-added image
Ra BajpaiRa Bajpai
@Harsish

In order to complete the challenge, you would need to put URL like below(@Amit Chaudhary 8 has suggested in his answer.)
<apex:outputLink value="/{!a.id}" > {!a.name} </apex:outputLink>
 
Ivo PetrovIvo Petrov

For all who are wondering how to full URL should work, this is it:

<apex:outputLink value="https://brave-panda-g71exy-dev-ed.lightning.force.com/lightning/r/Account/{!a.id}/view" >

Seems the component has some magic that makes it know where to place the a.id. 

Jonathan A FoxJonathan A Fox
can anyone explain to me why the / is requiered in the /{!a.id} part of this?
Aman ParateAman Parate
<apex:page standardController="Account" recordSetVar="accounts" >        
    <apex:repeat value="{!accounts}" var="a">
        <li>
            <apex:outputLink value="/{!a.id}"> {!a.name} </apex:outputLink>
        </li>
    </apex:repeat>        
</apex:page>


Try this!
Utkarsh Yadav 9Utkarsh Yadav 9
This shall work.


<apex:page standardController="Account" recordSetVar="accounts">
   <apex:repeat var="a" value="{!accounts}">
      <li>
          <apex:outputLink value="/{!a.id}" >
           {!a.name}
          </apex:outputLink>
     </li>
   </apex:repeat>
</apex:page>
Milind GiteMilind Gite
Try this:-
<apex:page standardController="Account" recordSetVar="Accounts">
    <apex:pageBlock title="AccountList">
        <apex:repeat value="{!Account}" var="a">
            <li>
                <apex:outputLink value="/{!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageBlock>
</apex:page>