I am trying to add a custom object related list onto a tabbed visualforce page. every time i do it comes up with an error:

'Inspection__c' is not a valid child relationship name for entity Account

The code is below:

<apex:page standardController="Account" showHeader="true" 
      tabStyle="account" >
      .activeTab {background-color: #236FBD; color:white; 
      .inactiveTab { background-color: lightgrey; color:black; 
   <apex:tabPanel switchType="client" selectedTab="tabdetails" 
                  id="AccountTabPanel" tabClass="activeTab" 
      <apex:tab label="Details" name="AccDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true" inlineEdit="true"/>
      <apex:tab label="Contacts" name="Contacts" id="tabContact">
         <apex:relatedList subject="{!account}" list="contacts" />
      <apex:tab label="Opportunities" name="Opportunities" 
         <apex:relatedList subject="{!account}" 
                           list="opportunities" />
      <apex:tab label="Inspections" name="Inspection" 
         <apex:relatedList subject="{!account}" 
                           list="Inspection__c" />
      <apex:tab label="Open Activities" name="OpenActivities" 
         <apex:relatedList subject="{!account}" 
                           list="OpenActivities" />
      <apex:tab label="Notes and Attachments" 
                name="NotesAndAttachments" id="tabNoteAtt">
         <apex:relatedList subject="{!account}" 
                           list="CombinedAttachments" />

The custom object, Inspections, is 3/4 of the way down.

Thanks so much in advance.


When you use a relationship name in a query or in related list, you must use the relationship names without the __c. Instead, append an __r (underscore underscore r).

so it will be Inspections__r instead of Inspection__c

You can read more about relationship name in Salesforce reference guide

  • Unfortunately that doesn't work. i changed list="Inspection__r" /> but i still get the same error.
    – neo2049
    May 9 '16 at 12:43
  • check relationship name, it can be Inspections__r as well because it depends on you what you have added while creating object
    – Himanshu
    May 9 '16 at 12:58
  • Thanks. The child name is Inpections__r with an s at the end so all is working now.
    – neo2049
    May 9 '16 at 13:06

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.