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
Abhishek MallikAbhishek Mallik 

Issue in Visualforce standard list controller trail challenge

Hi,

I am trying to solve a  trail challeng on Visualforce standard list controller (Visualforce standard list controller trail (https://trailhead.salesforce.com/content/learn/modules/visualforce_fundamentals/visualforce_standard_list_controllers)). I have written the following code for the same:
 
<apex:page standardController="Account" recordSetVar="accounts"> 
<apex:pageBlock> 
<apex:repeat value="{! accounts }" var="a"> 
 <li><apex:outputLink value="{! a.id}"></apex:outputLink> </li> 
</apex:repeat> 
</apex:pageBlock> 
</apex:page>


Here while checking, I am getting following error:
 
The page does not bind to the record ID value (in order to link to the record detail page)
Best Answer chosen by Abhishek Mallik
Khan AnasKhan Anas (Salesforce Developers) 
Hi Abhishek,

Greetings to you!

For each record, the repeater uses the apex:outputLink component to link to the respective record detail page. Please try below code:
<apex:page standardController="Account" recordSetVar="accounts" >
    <apex:pageblock>
        <apex:repeat var="a" value="{!accounts}" rendered="true" >
            <li>
                <apex:outputLink value="/{!a.Id}" >
                    <apex:outputText value="{!a.Name}"/>
                </apex:outputLink>
            </li>
        </apex:repeat>
    </apex:pageblock>
</apex:page>

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas