+ Start a Discussion

Two relatedlists with different subjects

I have two apex:relatedLists on a VisualForce page, each with a different account as the subject. When the page is rendered it always renders both relatedLists with the subject of the first relatedList in the source.


For example, this code always renders both lists as though their subject is accountOne, even though when you look at the names and Ids that are rendered they are different. If I switch the subject of the first list to accountTwo and the second to accountOne, then they both render the list for accountTwo.


Is this a VisualForce bug (or feature?)? Or am I doing something wrong?



<table cellpadding="0" cellspacing="0">
<h2 class="mainTitle">Primary: {!accountOne.Name} ({!accountOne.CreatedBy.Name} on {!accountOne.CreatedDate}) [{!accountOne.Id}]</h2>
<apex:relatedList id="list1" list="Financial_Facts__r" subject="{!accountOne}" pageSize="100" />
<h2 class="mainTitle">Secondary: {!accountTwo.Name} ({!accountTwo.CreatedBy.Name} on {!accountTwo.CreatedDate}) [{!accountTwo.Id}]</h2>
<apex:relatedList id="list2" list="Financial_Facts__r" subject="{!accountTwo}" pageSize="100" />



Afzal MohammadAfzal Mohammad

Ideally a record id is supposed to be passed, to subject atribute.


If subject is not specified, and if using a standard controller, this value is automatically set to the value of the ID query string
parameter in the page URL.


You may try passing respective accound ids to your related list.


Hope that helps.




Unfortunately I have tried that already and it still has the same behavior.


Noone has seen this issue before?


I have opened a support ticket regarding this. I am convinced that it is a bug in the relatedList control. In the mean time I have had to custom develop an equivalent control.