0

This is the Trailhead question :

Using a Standard List Controller, create a Visualforce page which displays a list of Accounts with links to their respective record detail pages. The page must be named 'AccountList'. It must reference the Account standard controller. It must have a recordSetVar equal to 'accounts'. It must have a Visualforce apex:repeat component. The repeater must have the var attribute set to 'a'. The repeater must use the <li> HTML list tag The repeater must use the apex:outputLink component to link to the respective record detail page HINT: Record detail pages can be reached by placing a record ID at the root of the URL (e.g. '/')

This is my Code answer for the same .. but the Output visualforce page doesnot display the list of accounts as expected - though the salesforce trailhead says challenge complete - can someone help

<apex:page standardController="Account" recordSetVar="accounts">
 <apex:form >


 <apex:pageBlock >
 <apex:pageBlockSection title=" List of Accounts">

 <apex:repeat value="{! accounts}" var="a">

 <ul>
  <li>



 <apex:outputLink value="{!URLFOR($Action.Account.View, a.Id )}"
 rendered="True" disabled="False" onclick="View">


 </apex:outputLink>

 </li>
 </ul>

 </apex:repeat>

 </apex:pageBlockSection>

 </apex:pageBlock>


 </apex:form>


</apex:page>

1 Answer 1

0

You need some text inside this tag <apex:outputLink ...></apex:outputLink> such as:

 <apex:outputLink ...>{!a.Name}</apex:outputLink>

as otherwise the link is not visible or clickable.

(I also suggest you get into the habit of removing blank lines that have no purpose and of indenting nested elements; that will make it easier for you to see the structure of your pages or code.)

2
  • Keith thanks for the input : Made this change :<apex:outputLink value="ap2.salesforce.com/apex/AccountDetail?core.apexpages.request. devconsole=1&id={! a.id}" rendered="True" disabled="False" onclick="View" onfocus="Display">{!a.Name} </apex:outputLink> This works but suprisingly gives this 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). Commented Jun 5, 2016 at 12:17
  • @RajivV.Subramanian That's a separate question really. But based on what you posted it sounds like they are looking for is value="/{!a.id}".
    – Keith C
    Commented Jun 5, 2016 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .