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
Kathy LKathy L 

Related List showing on a VisualForce page

I'm having troubles getting the Relationships related list to show in a visualforce page. Here is what I have:

 
<apex:page standardController="campaign"  showHeader="false" >
<!--REPEAT STARTS -->
    <apex:repeat value="{!campaign.CampaignMembers}" var="cm" >
 
<!--Plenty of other code in between, but that is irrelevant-->
 
<apex:relatedList subject="{!cm.ContactID}" list="Relationships" title="Relationships"/>
</apex:page>
 
Any help is greatly appreciated!
 
Kathy L.
dmchengdmcheng

A standard controller does not traverse child objects' relationships to retrieve further levels of child objects.  I.e. the controller is not retrieving the Relationship records for the contacts.

 

You will need to write a custom controller that explicitly retrieves the campaign, campaign members, and relationship records.

 

(BTW - You are referring to the Nonprofit Starter Pack relationships object, right?)

Shiva Ramesh @ xcdhrShiva Ramesh @ xcdhr

Hi Kathy L

 

You need to use like this Relationships__r. Change it on your code.

<apex:relatedList subject="{!cm.ContactID}" list="Relationships__r" title="Relationships"/>

 

 

timNimtimNim

VF pages can traverse relationships on multiple objects.  From the campaign list we can pull up Cases, NotesandAttachments, even tried a custom object (yes, added the "__r").  The issue may be related to campaign members not always being contacts.  Sometimes they are Leads which would render that list unretreivable.  Could we render out the leads (only show if "Campaignmember.lead=Null)?

 

-t