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
Jake GmerekJake Gmerek 

Question about <apex:relatedList>

Hello,

 

I have a case where I want my VF page to display a related list.  However, I can not find a way to define which fields show up on the resulting list.  My understanding, and what I have seen, is that the field list is pulled from the related list on the default page layout for that record type on the given object.  The problem that I run into is that we are using the default page layout still and I do not want the related list in question to show up on it, but whenever I remove the related list from the default page layout the related list on the VF page just defaults to showing the ID field.

 

My question is then, does anyone know of a different way to set the fields that are displayed by the relatedList tag?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

According to the docs, the behaviour you are seeing is correct - it doesn't have to be on the page layout and I'd imagine if it isn' t on the page layout it only has the one id field that must always be present in a related list.

 

I'm not aware of any way to influence these fields - I've tended to create my own relatedlist lookalike when I need this level of control.

All Answers

bob_buzzardbob_buzzard

According to the docs, the behaviour you are seeing is correct - it doesn't have to be on the page layout and I'd imagine if it isn' t on the page layout it only has the one id field that must always be present in a related list.

 

I'm not aware of any way to influence these fields - I've tended to create my own relatedlist lookalike when I need this level of control.

This was selected as the best answer
Jake GmerekJake Gmerek

Thanks Bob, I figured as much, but just thought that I would ask first.

Jake GmerekJake Gmerek

In case you are interested, here is a post about a dynamic VF, custom component that I created to replicate the related list feature:

 

http://jakemuse.blogspot.com/2012/03/visualforce-custom-related-list.html

bob_buzzardbob_buzzard

Thanks for sharing.