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
Adam FranklinAdam Franklin 

Placing a Parent Object's related list on a child object's page layout

I'm trying to determine what path I should be pursuing for this one:

I have a custom object, Service_Utilization__c which has a lookup relationship to both the Contact and Account objects.  

Each record in the object represents a Contact who is currently using a service (such as a project).   A single contact may be utilizing more than one service, and a service may be utilized by more than one contact (a project might have more than contact associated to it).

What I'd like to do is place this information on a related list or other table inside the case page layout.   I'm thinking it will be some kind of embedded visualforce page, but I'm open to suggestions.

What I seem to be running into is the issue of trying to traverse UP to the contact, and then down to the Contact's child object (Service Utilization) to get the records.    It seems relatively simple, but I've been trying a variety of solutions and none seem to do the job.
   
What I'd like is some direction on where I should be looking to figure out the solution.

Thanks!
 
BalajiRanganathanBalajiRanganathan
You can try this. Create a VF page as given below. create a new section in case page layout and embed this VF in that section.
<apex:page standardController="Case">
<apex:relatedList list="Service_Utilization__c"  subject="{Case.Accountid}"/>
</apex:page>

Refer this link to refer how to embed VF into Page Layout
https://developer.salesforce.com/blogs/systems-integrator/2008/11/adding-a-visualforce-page-to-a-page-layout.html
Adam FranklinAdam Franklin
Thanks Balaji!

This works pretty well.  Let's say that I wanted to make a custom VF page - maybe display the related list information as a dataTable or pageBlockTable.   Would I need to write an extension of the Case controller to achieve this?
BalajiRanganathanBalajiRanganathan
Yes I Think, we need to have a controller extn to get the list of Service_Utilization__c.