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
Srini GiridharSrini Giridhar 

Hyperlink on VF page to link to standard account page

Hi All,

I have created a VF page to display list of Accounts based on a criteria.
Now, I want each of the account displayed to be a link to standard Account detail page.

Can someone help me how I can achieve this? 

Thanks,
Srini

Best Answer chosen by Srini Giridhar
SarfarajSarfaraj
Hi Srini

<apex:page controller="accountListPageController" >
    <apex:pageBlock >
    <apex:pageBlockTable value="{!accounts}" var="account">
        <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}">
            <apex:outputLink value="/{!account.Id}">{!account.Name}</apex:outputLink>
        </apex:column>
    </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
public with sharing class accountListPageController {
    public list<Account> accounts{get{return [Select Id, Name From Account];}}
}



All Answers

SarfarajSarfaraj
Hi Srini

<apex:page controller="accountListPageController" >
    <apex:pageBlock >
    <apex:pageBlockTable value="{!accounts}" var="account">
        <apex:column headerValue="{!$ObjectType.Account.fields.Name.Label}">
            <apex:outputLink value="/{!account.Id}">{!account.Name}</apex:outputLink>
        </apex:column>
    </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>
public with sharing class accountListPageController {
    public list<Account> accounts{get{return [Select Id, Name From Account];}}
}



This was selected as the best answer
Srini GiridharSrini Giridhar
Thank you Akram. Exactly what I wanted :-)