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
AmbigaRamAmbigaRam 

How to display the list of records with link?

Hi, 

 

I want to show the list of records with the link using VF page.

 

When I click any one of the  link of the record from list, It  has to show the details of the record.

 

Can anyone help for this?

 

Thanks and Regards.,

R.Ambiga

Best Answer chosen by Admin (Salesforce Developers) 
Puja_mfsiPuja_mfsi

Hi,

you can create a controller which query the records from any object and display that list into the VF with apex:pageBlockTable etc.

 

Controller :

 

public Class AccountController {

      

     public List<Account> getAccList() {

            return [select id,name,Type from Account];  // return the list of accounts.

      }

}

 

VF :

 

<apex:page controller="AccountController">

        <apex:form>

                 <apex:pageBlock title="Account Records">

                             <apex:pageBlockTable value="{!AccList}" var="acc">

                                       <apex:column headerValue="Name">

                                                <apex:outputLink value="/{!acc.id}"> {!acc.name}</apex:outputLink>

                                       </apex:column>

                                       <apex:column value="{!acc.type}"/>

 

                            </apex:pageBlockTable>

                  </apex:pageBlock>

        </apex:form>

</apex:page>

 

 

Please let me know if u have any query on same and if this post helps you plz give KUDOS by click on star at left.

All Answers

Puja_mfsiPuja_mfsi

Hi,

you can create a controller which query the records from any object and display that list into the VF with apex:pageBlockTable etc.

 

Controller :

 

public Class AccountController {

      

     public List<Account> getAccList() {

            return [select id,name,Type from Account];  // return the list of accounts.

      }

}

 

VF :

 

<apex:page controller="AccountController">

        <apex:form>

                 <apex:pageBlock title="Account Records">

                             <apex:pageBlockTable value="{!AccList}" var="acc">

                                       <apex:column headerValue="Name">

                                                <apex:outputLink value="/{!acc.id}"> {!acc.name}</apex:outputLink>

                                       </apex:column>

                                       <apex:column value="{!acc.type}"/>

 

                            </apex:pageBlockTable>

                  </apex:pageBlock>

        </apex:form>

</apex:page>

 

 

Please let me know if u have any query on same and if this post helps you plz give KUDOS by click on star at left.

This was selected as the best answer
AmbigaRamAmbigaRam

Thanks Puja,

 

I'll try this code .

 

 

Regards,

R.Ambiga

Sai NiranjanSai Niranjan
Hi Puja,

I tried your code, but it is not working. I want to display some list of records and I should be able to open the record from there(VF Page). This is my requirement.

Thanks
Niranjan