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
Anshuta Awasthi 7Anshuta Awasthi 7 

Getting error on "Using Standard Controller List" challenge in trailhead module named "Visualforce Basics"

Here is my code for a challenge .
<apex:page standardController="Account" recordsetVar="accounts">
    <apex:pageBlock title="Account List">
          
            <apex:repeat value="{!accounts}" var="a">
<li> 
    <apex:outputLink value="https://ap2.salesforce.com/{!a.ID}"> {!a.ID} </apex:outputLink>
    
                </li>         
                
            </apex:repeat>
   </apex:pageBlock>
</apex:page>
I am getting perfect output but when i click on check challenge button. I get the below error in trailhead:

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)
Maharajan CMaharajan C
Hi Anshuta,

Try this 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>

Let me Know is that Helpful to you

Thanks
RAJ.
(Sweet Potato Tec) 
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BROJIA4

your code should be like below
<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>


 
Puneet Bajaj 3Puneet Bajaj 3
Hi Anshuta,

You should not specify https://ap2.salesforce.com, just using right slash / inside the value tag will work.
The code should be like this (including pageblock):
 
<apex:page standardController="Account" recordSetVar="accounts">
<apex:pageBlock title="Accounts List">  
<ol>
<apex:repeat value="{!accounts}" var="a" > 
<li>
<apex:outputLink value="/{!a.Id}"> {!a.Name} </apex:outputLink>
</li>
</apex:repeat> 
</ol>
</apex:pageBlock>
</apex:page>
Thanks,
Puneet
 
Anshuta Awasthi 7Anshuta Awasthi 7
thanks Puneet.It worked!