+ Start a Discussion
Ashok S 7Ashok S 7 

how can i use the record id to bind the vf page

Hai guys,
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>').
how can i achieve it.
my vf page code is
<apex:page standardController="Account" recordSetVar="accounts">
  <apex:form >
  <apex:repeat value="{!accounts}" var="a">
 
  
 <li> <apex:outputLink value="/apex/AccountList?id=00128000005LpU9">
  
  {!Account.Name}
  
  </apex:outputLink>
</li>
  </apex:repeat>
  
  
  </apex:form>
</apex:page>
can any one help me
Best Answer chosen by Ashok S 7
William TranWilliam Tran
Here you go, clicking the name should take you to the apex AccountList page.

Thx
 
<apex:page standardController="Account" recordSetVar="accounts">
        <apex:repeat var="a" value="{!accounts}">
            <li>
                <apex:outputLink value="/apex/AccountList?id={!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
        </apex:repeat>

</apex:page>




 

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below code. I hope that will help u
<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 this will help u

Thanks
Amit Chaudhary
 
William TranWilliam Tran
Here you go, clicking the name should take you to the apex AccountList page.

Thx
 
<apex:page standardController="Account" recordSetVar="accounts">
        <apex:repeat var="a" value="{!accounts}">
            <li>
                <apex:outputLink value="/apex/AccountList?id={!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
        </apex:repeat>

</apex:page>




 
This was selected as the best answer
Amit Chaudhary 8Amit Chaudhary 8
Hi Ashok,

I am not wrong then your page name should be "AccountList". And we need to redirect to Account record not on the "AccountList" page
See  below lin for task detail :-
https://developer.salesforce.com/trailhead/visualforce_fundamentals/visualforce_standard_list_controllers

So your link should be below
<li>
                <apex:outputLink value="/{!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
Not below
<li>
                <apex:outputLink value="/apex/AccountList?id={!a.id}" >
                    {!a.name}
                </apex:outputLink>
            </li>
Please let us know if this will help u



 
Igor MorozovIgor Morozov
Hi all,

I think the best way to complete this challenge is place li tag under apex:outputLink tag. Otherwise it looks awful.
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock>
    	<apex:pageBlockSection>
            <apex:repeat var="a" value="{!accounts}">
                <apex:outputLink value="/{!a.Id}">
                    <li>
                        <apex:outputText value="{!a.Name}"/>
                    </li>
                </apex:outputLink>
            </apex:repeat>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

 
Kishan MalepuKishan Malepu
Hi All,
 Try this  one...
<apex:repeat value="{!accounts}" var="a">
    <apex:outputLink value="/{!a.Id}">
        <li>{!a.Name}</li>
    </apex:outputLink> 
</apex:repeat>
Nash79Nash79

Thanks Kishan and Igor, It worked for me as welll. But what is the use of <Li>?
 

Regards, Nagesh

Kishan MalepuKishan Malepu
Kishan Malepu
@Nagesh,

Its HTML tag..It is used to list the items
<li>Pen</li>
User-added image
 Try this to know more info: http://www.w3schools.com/html/html_lists.asp


Thanks & Regards,
Kishan
Nash79Nash79
Once again, Thank you Kishan!
Abhishek Verma 34Abhishek Verma 34
The correct answer is:

<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>
Shauryanaditya SinghShauryanaditya Singh
You asked the trailhead question indirectly. Write at start that it's a spoiler.
Veena GopalVeena Gopal
Amit Chaudhary 8 is right
Shauryanaditya Singh -you are right but the concept is very tough
Ahmed ZwawyAhmed Zwawy
<apex:page standardController="Account" recordSetVar="accounts" >
     <apex:pageBlock title="Accounts List" id="accounts_list">
        <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>
Dhanik Lal SahniDhanik Lal Sahni
<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>
Robin Bansal 17Robin Bansal 17
Hi...for me its still ot working. The record list doesn't come up on the page. I am using below code.
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Accounts List" id="accounts_list">
    <apex:repeat value="{!accounts}" var="a"> 
        <li>
            <apex:outputLink value="/{!a.id}" >
                {!a.name}
            </apex:outputLink> 
        </li>
    </apex:repeat> 
    </apex:pageBlock>
</apex:page>
Robin Bansal 17Robin Bansal 17
do I need to append the account id while rendering the page? e.g.: 
https://playful-goat-385395-dev-ed--c.ap5.visual.force.com/apex/AccountList?core.apexpages.request.devconsole=1&id=0017F00000KotbPQAR
Nayantara MondalNayantara Mondal
Great !!!

It works properly...
Vickey PandeyVickey Pandey
Use This Code !!!! It works fine .........

****************************************          Code *******************************************************

<apex:page standardController="Account" recordSetVar="Accounts">
     
    <apex:pageBlock>
       <apex:repeat value="{!Account}" var="a" 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>
 
Govind Sankhala 4Govind Sankhala 4
Use below code, It works fine.

<apex:page standardController="Account" recordSetVar="accounts">
    <ol>
        <apex:repeat value="{!accounts}" var="a">
            <li> 
                <apex:outputLink value="/{!a.id}" >
                    {!a.Name}
                </apex:outputLink>
            </li>
    </apex:repeat>
    </ol>
</apex:page>
SANTOSHKUMAR TEMBHARESANTOSHKUMAR TEMBHARE
This code works fine 

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageblock >
            <apex:repeat value="{!accounts}" var="a"  rendered="true" id="Account_List">
            <li>
                <apex:outputLink value="/{!a.id}"> 
                    <apex:outputText value="{!a.name}"></apex:outputText>
                </apex:outputLink>
            </li>
            </apex:repeat>
</apex:pageblock>  
</apex:page>