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

How to display related list in the same VF page of a particular record ?

How to display related list in the same VF page when clicked upon any record of an object present in pageblock table ?




I have pageblock table with a list of filtered opportunity records, when i try to click on any record's Edit commandlink present in pageblock table , the page should display its corresponding "OpenActivities" relatedlist below the table. Is there any way to pass the clicked record id to the <apex:relatedlist> component , so that it can open the related list using this component.




Please help me with the code.



Rahul SharmaRahul Sharma

apex:relatedList automatically takes id from Url,


Try giving any account id to below code like /apex/yourpagename?id='Your Account Id':

<apex:page standardController="Account">
    <apex:pageBlock >
    You're looking at some related lists for {!}:
    <apex:relatedList list="OpenActivities" />