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
uptime_andrewuptime_andrew 

Case View Page - RelatedList problems

I have a Visualforce page to override our Case View page, however, having problems with the following relatedLists:

 

   <apex:relatedlist list="CaseComments" />
   <apex:relatedList list="EmailMessages" />
   <apex:relatedlist list="NotesandAttachments" />
   <apex:relatedList list="CaseHistories" />

 

All are resulting in the "is not a valid child relationship name for entity Case".  Any thoughts?

 

Shashikant SharmaShashikant Sharma

You missed to add subject

<apex:relatedlist list="CaseComments" subject="{!Case}" />
   <apex:relatedList list="EmailMessages" subject="{!Case}"/>
   <apex:relatedlist list="NotesandAttachments" subject="{!Case}"/>
   <apex:relatedList list="CaseHistories" subject="{!Case}"/>

uptime_andrewuptime_andrew

Thanks Shashikant - however, it's still giving me an error.

 

Adding <apex:relatedlist list="CaseComments" subject="{!Case}" /> still results in :

 

'CaseComments' is not a valid child relationship name for entity Case

Shashikant SharmaShashikant Sharma

Hi,

 

Please verify two things 

1) Standard controller for VFP is Case

2)You are using correct relationship name

uptime_andrewuptime_andrew

Yep, standardController is Case:

 

 

<apex:page standardController="Case" extensions="myExt" title="Case">

 

 

I believe it is the correct relationship name based on what I see in the schema (viewing via Eclipse), for example: 

 

Email Message - Relationship Name: EmailMessages

 

CaseComment - Relationship Name: CaseComments

 

Shashikant SharmaShashikant Sharma

I was able to save this

<apex:page standardController="Case" title="Case">
   <apex:relatedlist list="CaseComments" subject="{!Case}" />
   <apex:relatedList list="EmailMessages" />
   <apex:relatedlist list="NotesandAttachments" />
   <apex:relatedList list="CaseHistories" />
</apex:page>

 May be some issue in your extension class, could you please share it also.

 

uptime_andrewuptime_andrew

I've been able to save my page as well, and saved yours too.

 

However, when I view the page, I get the errors (e.g. 'CaseComments' is not a valid child relationship name for entity Case ).

 

Do you not get an error when you try to view the page?

InternalServerErrorInternalServerError

Hey Andrew, did you manage to find the solution for this?

 

Thanks

aj2taylo2aj2taylo2

The solution having to create the related lists with the markup manually, rather than use the standard reference.  It ended up working, but was a bit time consuming.

InternalServerErrorInternalServerError

Thanks, not what I wanted to hear though :(

Jia HuJia Hu

<apex:page standardController="case">

<apex:dataTable value="{!Case.EmailMessages}" var="email">
<apex:column value="{!email.Subject}" />

 ....
</apex:dataTable>

<apex:dataTable value="{!Case.CaseComments}" var="cc">
<apex:column value="{!cc.Id}" />

 .....
</apex:dataTable>

</apex:page>