Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

enter image description hereI am using the following VF page for Lead related List VF page and it is not working

{
<apex:page standardController="Lead">
  <apex:relatedList list="Campaign History" />
  <apex:relatedList list="Opportunities" />
  <apex:relatedList list="Activity History" />
  <apex:relatedList list="Notes" />
  <apex:relatedList list="Open Activities" />
</apex:page>
                }
share|improve this question
    
Can you define "not working"? What do you see? – Sebastian Kessel Mar 28 at 22:21
    
/apex/CustomLayout?id=00*********** 'Campaign History' is not a valid child relationship name for entity Lead This is coming for all object related list – cloud lover Mar 28 at 22:23
up vote 5 down vote accepted

The reason for this issue is that the relatedList is not named "Campaign Histories"

Use:

<apex:relatedList list="CampaignMembers"/>

apex:relatedList list= values have to be valid relationship names taken from the schema. The friendly name as shown to the user is confusingly only tangentially related to the real relationship name.

enter image description here

share|improve this answer
    
Thanks :) How to take opportunity in related list as it is not working – cloud lover Mar 28 at 23:38
    
@cloudlover in your screen shot you do not have an Opportunity related list, also do not believe there to be one unless you created a custom relationship which then you would need to use the custom fields child relationship name. – Jenny B Mar 29 at 1:06
    
@cloudlover - Opportunities would be the name of an OOB relationship from Lead to Opportunity. There is no such OOB relationship. If you have a custom relationship, it would most likely be named Opportunities__r but custom relationships between Lead and Opportunity are extremely rare as once the Lead is converted, it disappears from user view – cropredy Mar 29 at 13:43

You have to use related list's reference names, not the titles. Here is 2 examples:

<apex:page standardController="Lead"> <apex:relatedList list="OpenActivities" /> <apex:relatedList list="ActivityHistories" /> </apex:page>

Unfortunately I don't know the names for other, and it doesn't look like you could have all listed, but there are also NotesAndAttachments, Histories, and CampaignMembers as @cropredy is pointing out in his answer.

share|improve this answer

The issue could be related to this one from the knowledge article here:

Description

This error occurs on a VisualForce page when a related list is being referenced but isn't available on the user's page. An example of this error would be

'OpenActivities' is not a valid child relationship name for entityOpportunity.

The problem can appear confusing when the related list is actually added to the page layout by the system administrator.

Resolution

However the related list has been removed by the individual user (it doesn't appear only for the user receiving the error message). The related list can be added back in by going to:

Setup | My Personal Information | Change My Display | Customize My Pages | Select the (custom/standard object) from the list | Customize My Pages.

Add the related list that is referenced at the start of the error message into the selected list and click save. This should resolve the error message.

Note: Some child relationship names are not the plural of the object name like the following:
HTML Email Status: "EmailStatuses", Activity History: "ActivityHistories", Notes and Attachments: "NotesAndAttachments", Approval History: "ProcessSteps", Campaign History: "CampaignMembers".

share|improve this answer
    
I have checked those things and they are already present – cloud lover Mar 28 at 22:30
    
@cloudlover it looks like another user ran into this issue as well and ended up using CampaignMembers vs History. salesforce.stackexchange.com/questions/68070/… – Jenny B Mar 28 at 22:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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