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
Ahilya SrivastavaAhilya Srivastava 

Choosing Columns to display in <apex:relatedList />

I have a VisualForce page where I'm trying to display a standard related list by using the <apex:relatedList /> tag. It seems like this should be simple, but I can't seem to find any way to choose which columns are displayed in the related list; the only column being displayed is the "Name" column.

I've tried editing the related list layout on the custom object's page layout, but this didn't affect my VisualForce page.

Is there any way I can display more than just the "Name" column with an <apex:relatedList />?
Best Answer chosen by Ahilya Srivastava
Prabhat Kumar12Prabhat Kumar12
Content of <apex:relatedList> will match what your user would see for same record on standard page layout. So your best choice is to configure the list on page layout. Remember that if you still don't see the fields you expect, the standard caveats apply:

do you have rights to read on the fields from the related list?
if the fields are lookups - do you have at least "Read" right to the referenced object
(licensed package fields) do you have have a licence associated to your user
(page layout assignment depends on Profile and optionally on Record Type) are you sure you've modified the right page layout for your combination?