+ Start a Discussion
DoondiDoondi 

Go to list(13) on relatedList

Hi,
I wanted to know how to build "Go to LIst(13) Link available on related list of Master object.
fucntionality I require:
when user click on "Go to List" 
I need to redirect to page that has Master object's related list.
below is the picture of requirement.

show morerelatedlist
NagendraNagendra (Salesforce Developers) 
Hi Doondi,

General approach:

To achieve this you will need to create a visual force page with a controller. You can pass via the link of the visual force page the Id of a particular school, then in the controller, you can run a parent-to-child query so that you can get all the related students. The query should look like as follows:
SELECT Id, (SELECT Id, Name FROM Students)
FROM School
WHERE Id = :schoolId
Hope this helps.

Kindly mark this as solved if the reply was helpful so that it gets removed from the unanswered queue which results in helping others who are facing a similar issue.

Thanks,
Nagendra
 
DoondiDoondi
what do I need to use in commandLInk?
onclick or action ? 
or any standard action fuction?
DoondiDoondi
Hi, this is my current code, but am not able to save the class.
<apex:page standardController="Student__c" extensions="StudentsPageController">
    <apex:pageBlock>
        <apex:pageBlockTable value="{!students}" var="u">
            <apex:column value="{!u.name}"/>
            <apex:column value="{!u.class}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
	============================================
	public class StudentsPageController {
	public List<Student__c> students{get;set;}
    public school__c scl {get;set;}
    
    public UnitsPageController(ApexPages.StandardController controller)
{	
        { 
            scl = (Property__c)controller.getRecord();      
            students=[SELECT Id, (SELECT Id, Name,class FROM student__c) FROM School__c WHERE Id = :scl.id];
        }
}