3

I am trying to create a Visualforce page to be displayed inline on a custom object page layout (Project__c) so that I can display a list of case emails on the case for the case related to the project.

The metadata tells me that the relationship name is "EmailMessages", so I created the following Visualforce page:

<apex:page standardcontroller="Project__c" showHeader="false" sidebar="false">
    <apex:relatedList list="EmailMessages" subject="{!Project__c.Case__c}"/>
</apex:page>

However when I view the page I get:

   Content cannot be displayed: 'EmailMessages' is not a valid child relationship name for entity Case

Wondering if anyone else has run across this and knows of the correct relationship name or a workaround other than having to manually replicate this related list?

1

Oftentimes, this is caused by the user not being able to access this object or if this related list is not currently displayed on the page layouts. This type of syntax might help:

Also, if users have overridden the standard page layouts to remove a related list, this can cause an issue. Make sure to override all users' customizations for this related list.

  • Thanks for your response. I have 30+ Case page layouts where some have the Emails related list. I have re-added the list to one of these layouts and overridden for users customizations, however this has not made any difference. – luke.mcfarlane Jun 25 '13 at 22:34
1

Luke, this is exactly what the user here was facing. How to specify Attachments related list in a VF page?

Go to setup--> develope --> API generate the enterprise WSDL. see what the name of the related list is.

OR

Schema.DescribeSObjectResult d = Project__c.sObjectType.getDescribe();
List<Schema.ChildRelationship> relationships = d.getChildRelationships();

String listOfRelationshipNames = '';
for(Schema.ChildRelationship rel:relationships){
    listOfRelationshipNames = listOfRelationshipNames + rel.getRelationshipName() + ', ';
}

System.debug(listOfRelationshipNames);

This should give you the related list name.

  • Thanks for your response. I generated the enterprise WSDL and was able to confirm that the relationship name is indeed "EmailMessages": <element name="EmailMessages" nillable="true" minOccurs="0" type="tns:QueryResult"/> This is the same as what checking the metadata told me (I used workbench.developerforce.com), however the related list still isn't working. I would say that Saleseforce treats EmailMessages as one of their "special" related lists that we can't hook into. – luke.mcfarlane Jun 25 '13 at 21:27
  • Looks like CaseComments and emailmessages are a big time issues for many in the development forum.I am pretty sure you have done some research around this, but isthe related list "emailmessages" exposed on your pagelayout as tannershamrock pointed? – Rao Jun 25 '13 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.