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
BCdeveloperBCdeveloper 

Add new related lists to Tabbed Accounts?

    Hi can someone please assist. See the VisualForce code below. This results in tabs for detail and Opportunities on the contact object. Works great. But now, i am simply trying to add-on a new tab which points to a custom object called "LODA_Restaurants__c". I have tried absolutely every "list" value, LODA_Restaurants__r, LODA_Restaurants, nothing works. It keeps saying "'LODA-Restaurants__r' is not a valid child relationship name for entity Contact". This custom object is most definitely a related list item on Contacts, I see values showing  up when I view the contact. Can someone please help? Thanks!!! -Brad

<apex:page standardController="Contact" showHeader="true" tabStyle="contact" >
   <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
     <apex:tab label="Details" name="AccDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true"/>
      </apex:tab>
           <apex:tab label="Opportunities" name="Opportunities" id="tabOpp2">
         <apex:relatedList subject="{!contact}" list="opportunities" />
      </apex:tab>
    <
       <apex:tab label="Opportunitiesx" name="Opportunitiesrxe" id="tabOpp3r2">
         <apex:relatedList subject="{!contact}" list="LODA-Restaurants__r" />
      </apex:tab>
     
     
   </apex:tabPanel>
</apex:page>
Ron HessRon Hess
can you search for the name in the WSDL ?

looks like you have a dash '-' instead of an underline '_'

the name will be spelled out in the WSDL.
BCdeveloperBCdeveloper

Hi Ron, well I looked at the WSDL, and expanded the section of "Contacts". Since the lookup relationship is actually a field on the Custom Object (LODA-Restaurants__C), I looked there instead. I see the lookup I created, which the element name is "Contact__c". I tried this, Contact__r, Contacts__c, nothing works, I get the same error.

I guess the main question is, what value should be in this "list" variable? Is it the API name of the custom object of the related list you are referencing? Is it the field name of the lookup relationship? I've tried absolutely all of those, and still get that error... I'm simply trying to get a tab on the top to reference this custom object related list as it does for Opportunities!

jwetzlerjwetzler
First of all I think there might be a problem with the fact that you have subject="{!contact}".  Subject takes an id, and if you're using the standardController it will automatically take the id that's passed into the query string, so you shouldn't need a subject at all.  Please refer to the doc for this attribute.

There are quite a few posts on the forums about people not being able to find relationship names, so searching around might help a little.  I think you need to make sure that the relationship name is explicitly defined in your field definition, rather than leaving it blank (I believe we have a bug somewhere about not using the default relationship name).  Also, the related list has to exist on your page layout in order for it to be found.
BCdeveloperBCdeveloper
Thanks Julie!!! That was it!
 
I needed to specify a name in the child relationship field of the lookup field, and then append a "__r".
 
Thanks so much!!!!!
 
Brad
JAW99JAW99
I'd love some clarification on the resolution of this issue.
ShikibuShikibu