Skip to main content
TharunKumar Chada ha fatto una domanda in #Visualforce
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. '/<record id>')

I tried this code i am able to retrieve the records and clicking on each record showing  the detail page of that record.But Still Trail Head is showing error.Can someone guide me if  I am wrong

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

    <apex:pageBlock title="Accounts">

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

      <li>

       <apex:outputLink value="{!URLFOR($Action.Account.view, a.id)}">{!a.Name}

       </apex:outputLink>

     </li>

   </apex:repeat>

   </apex:pageBlock> 

</apex:page>

 
12 risposte
  1. 15 set 2015, 04:34
    Hi Tharun,

    As it is mentioned in the hint, that you need to place record Id at the end of url like '/<record id>', that's why you are not able to complete the challenge. Use this:

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

    <apex:pageBlock title="Accounts">

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

    <li>

    <apex:outputLink value="/{!a.id}">{!a.Name}</apex:outputLink>

    </li>

    </apex:repeat>

    </apex:pageBlock>

    </apex:page>

    Let me know, if you need any other help.

    Thanks,

    Neetu
0/9000