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
Pardhu ThottempudiPardhu Thottempudi 

Using a Standard List Controller, create a Visualforce page which displays a list of Accounts with links to their respective record detail pages.

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>').
 
Best Answer chosen by Pardhu Thottempudi
Khan AnasKhan Anas (Salesforce Developers) 
Hi Pardhu,

Greetings to you!

Please try the below code, I have tested in my org and it is working fine.
 
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock> 
        <apex:repeat value="{!accounts}" var="a">
            <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

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Pardhu,

Greetings to you!

Please try the below code, I have tested in my org and it is working fine.
 
<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock> 
        <apex:repeat value="{!accounts}" var="a">
            <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
This was selected as the best answer
Pardhu ThottempudiPardhu Thottempudi
Hi Khan,
 Thank you so much for your efforts to give solution 
Pardhu ThottempudiPardhu Thottempudi
I tried in this way that's why i will not get answer

<apex:page standardController="Account" recordSetVar="accounts">
<apex:pageBlock >
<apex:repeat value="{!accounts}" var="a">

<li>
<apex:outputLink value="{!a.Id}"/>
<apex:outputText value="{!a.id}"/>
&nbsp;&nbsp;
<apex:outputLink value="{!a.Name}"/>
<apex:outputText value="{!a.Name}"/>
</li>

</apex:repeat>
</apex:pageBlock>
</apex:page>


 
Simran BansalSimran Bansal
@Khan Anas
  why you use "/" before  {!a.ID}in below line
<apex:outputLink value="/{!a.ID}">
 
TaraSrinivas ChandikaTaraSrinivas Chandika
The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores.
vikram kasotevikram kasote

@Simran Bansal
When I removed that / it showed error "The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores." when I clicked on link in the output.

when you put "/" account link redirects to account.