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
InternalServerErrorInternalServerError 

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

I am getting this error when viewing a case my page is very simple using the case standard controller, no extensions.

 

Note: These related list have been added to all the page layouts.

 

 

 <apex:relatedList list="EmailMessages"/>

 

Any ideas?

Jia HuJia Hu
apex:relatedList is used for:

A list of Salesforce records that are related to a parent record with a lookup or master-detail relationship.

EmailMessage has no relationship with Case I guess.
InternalServerErrorInternalServerError

Thanks Jia but EmailMessages has a valid child relationship with cases, so there must be something else.

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_emailmessage.htm

Jia HuJia Hu

You are right. But this is a problem of  apex:relatedList, not only EmailMessages, but also CaseComments ,...

Even you can see the Case Comments on the related list of the standard case page,....

 

You can use following,...

 

<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>