1

Does anyone know how I can pull Case related lists into a custom Visualforce page? I know I can use the syntax:

<apex:relatedList list="NotesAndAttachments"/>

in other pages, however, I cannot get it to work on cases. I am looking to add the related lists for:

Emails
Related Cases
Solutions
Case Comments
Open Activities
Case History
Attachments

2 Answers 2

1

You can run the following in Execute Anonymous to find the Child Relationship names.

DescribeSObjectResult describe = SObjectType.Case;
for (ChildRelationship relationship : describe.getChildRelationships())
    system.debug(relationship);

A naive copy to the list attribute yields:

<apex:page standardController="Case">
    <!--apex:relatedList list="EmailMessages" /-->
    <apex:relatedList list="Cases" />
    <apex:relatedList list="CaseSolutions" />
    <!--apex:relatedList list="CaseComments" /-->
    <apex:relatedList list="OpenActivities" />
    <apex:relatedList list="ActivityHistories" />
    <!--apex:relatedList list="Histories" /-->
    <!--apex:relatedList list="Attachments" /-->
</apex:page>

Commented out lists did not work. I will update with the missing names as I find them.

2
  • I believe you can't do relatedList on field histories on any sobject. So sad as it makes replacing OOB detail pages so difficult with VF when you want a mix of custom RL and OOB RL + apex:detail
    – cropredy
    Commented May 13, 2016 at 5:14
  • @cropredy -- I was afraid of that. Makes it more difficult to get the functionality I need.
    – J. Neilan
    Commented May 13, 2016 at 14:13
2

The Eclipse Schema Browser at the Apex Explorer are great tools to help with this.

See attached screenshot.

Relationship name

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .