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
Venkat Reddy 45Venkat Reddy 45 

Query records and Display list of records in a pageblocktable

Dear Experts,

          I want to "Query records and Display list of records in a pageblocktable" i.e.,display list of records in a page blocktable and add a command link to the name of the record. On click it should redirect me to the details of that particular record.

Regards,
Venkat.
Best Answer chosen by James Loghry
pconpcon
If you look at the documentation for pageBlockTable [1] you'll see how to iterate over a list of sObjects.  You will need to define your list of objects via a controller extension [2].  Then you will want to display your commandLink [3] just add it to a column [4] with the value being the URLFOR [5] the View action [6].

If after you have read over these and have attempted to create the Visualforce page and Controller and you still have any problems, please include the code you have written and I can help you fix any issues you have.

NOTE: When add code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.

[1] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_pageBlockTable.htm
[2] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htm
[3] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_commandLink.htm
[4] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_column.htm
[5] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_functions.htm
[6] https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_action_valid_values.htm