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
kjpetersonkjpeterson 

How Do You Figure Out Related List Names

I'm recreating a detail page and I'm trying to add some related lists that are currently displayed on the existing page.  I'm unable to figure out what the list names are supposed to be though.  The names that are used in the pagelayout editor are not working.  Some example list are "Notes & Attachments", "Approval History", and "Activity History".  How do you find out the names to use in visual force for related lists?
Best Answer chosen by Admin (Salesforce Developers) 
jhartjhart
NOTE TO ALL:

To get this to work, you have to add the related list to the custom object's default page layout.

I stumbled onto this by accident when trying to get "NotesAndAttachments" to work for my object's custom view page (which, funny enough, is used to override the standard view page ... but it only works if the standard view page has the related list in its page layout).

So my page has this markup:

Code:
<apex:page standardController="Email__c" extensions="CtlEmail" tabStyle="Email__c">
...
<apex:relatedList list="NotesAndAttachments" title="Attachments"/>
</apex:page>


If I remove the related list from the default page layout, I get this error:

'NotesAndAttachments' is not a valid child relationship name for entity Email

However, once I add the "Notes and Attachments" related list to the default page layout, the above markup works.

This is on an EE-class development org (test edition, specifically).
Message Edited by jhart on 12-04-2009 04:37 PM

All Answers

mtbclimbermtbclimber
If you don't have the Force.com IDE (Eclipse plugin) installed the easiest way is probably to download the enterprise wsdl for your organization.  Go to Setup > App Setup > Develop > API and click the link the for the enterprise WSDL. Go to the parent object definition and look through the items that are typed "QueryResult". These are the API names which you will need to use for your relatedList.list attribute.


jeroenjeroen

Thanks Andrew,

That was very usefull! I have been looking for this, but I didn't know where to look! :smileyvery-happy:

Regards

Jeroen

Anand SinghAnand Singh

Hi Andrew,

When I tried using "CaseComments"  as follows:
<apex:relatedList subject="{!$CurrentPage.parameters.id}" list="CaseComments" />

It does not works.
Please let me know your thoughts on this.

If the workaround is custom logic, then I am aware with it.

Thanks in advance,
Anand
Anand SinghAnand Singh

Also When I tried using "EmailMessages"  as follows:
<apex:relatedList subject="{!$CurrentPage.parameters.id}" list="EmailMessages" />

It also does not works.:smileysad:
Is this the correct way to show email messages in related list.(except custom logic)

Thanks in advance,
Anand

FreeFree
Hi,
 
I'm running into the same issue. A bit frustrating I shall admit...
 
Did you manage to have yours up and running ?
If so, could you let me know how you managed to do this ?
 
Thanks,
Free
jeroenjeroen
hi,
 
Here is what you are doing wrong, at least what I think!
This is the notes and attachment related list to the custom pbject project_info__c (see all the names in the WSDL earlier in this thread).
<apex:relatedList list="NotesAndAttachments" subject="{!Project_info__c}" />
 
So if I want the same for CaseComments in object Case, this should be it.....
 
<apex:relatedList list="CaseComments" subject="{!Case}" />
 
Hope this helps, let me know
 
Good luck and regards :smileyvery-happy:
Jeroen
FreeFree
Thanks jereon for the quick reply, but actually no, it still doesn't work :smileysad:
 
I'm getting this error message :
'CaseComments' is not a valid child relationship name for entity Case
Same for EmailMessages
 
Just can't figure out what it is I'm doing wrong :smileyindifferent:
jeroenjeroen
Do you want to list the comments?
 
If so, maybe this will work.
 

Strange! In my WSDL CaseComments is a link to CaseComment and should be able to work, I remember I had simmilar problems with histories, this is how I solved it. Might work for you

<apex:pageBlockTable value="{!Case.Cascomments}" var="c">
                <apex:column headerValue="Date"  value="{!c.createddate}"/>
                <apex:column headerValue="By"  value="{!c.CreatedById}"/>
                   etc etc            

                </apex:column>
</apex:pageBlockTable>

I am not sure about the createddate syntax, but you get my drift, now you can create your own list.

Hope this will help you :smileyvery-happy:

Regards

Jeroen

FreeFree

Thanks Jereon,

So if I get the point, I can't set this straightforwardly and have to redevelop the related list with pageblock sections ?

Thanks for the help, will try this out

mtbclimbermtbclimber
You've got the right relationship names. They are just not yet supported. If the child relationship has a related list on the parent layout then it should be supported CaseComments is a known exception to this rule.

And yes, if you want to present this related data you need to recreate it by following the pattern jeroen describes above.
FreeFree

Thanks ! Actually I'm more interested in EmailMessages but it's the same bargain...

Any hint on when this is due to be fixed ?
Cheers,

Free

GlennAtAppirioGlennAtAppirio
Aha. After a colleague and I tried in vain to figure out why our simple apex:relatedList with record history wasn't working, we finally stumbled across this thread. At least now we know for certain!

Our experiments seem to show that custom related lists work fine, but standard related lists don't work.

So this works:

Code:
<apex:relatedList list="My_Custom_Relationship__r" />

 
But this doesn't:

Code:
<apex:relatedList list="Histories" />

 
It doesn't work for Notes, Histories, Attachments, Events, OpenActivities, ProcessInstances, ProcessSteps, and probably a few others.

Hope this is fixed soon :)

Message Edited by GlennAtAppirio on 09-18-2008 08:28 PM
Derek LaneyDerek Laney
Ouch, thats a gotcha

Also applies to Approval History

Here's the idea to fill this gap: VOTE!

http://ideas.salesforce.com/article/show/10092627/Support_standard_related_lists_in_visualforce_components
OCDGeekOCDGeek
Look in the IDE under Child Relationships for the SObject with the relationship to be displayed then expand that SObject and look for the Relationship Name.

Many of the standard related lists are available. Try the plural form as most use that terminology. For example:
HTML Email Status: "EmailStatuses"
Activity History: "ActivityHistories"
Notes and Attachments: "NotesAndAttachments"

Some do not correlate well to their title:
Approval History: "ProcessSteps"
Campaign History: "CampaignMembers"
jhartjhart
NOTE TO ALL:

To get this to work, you have to add the related list to the custom object's default page layout.

I stumbled onto this by accident when trying to get "NotesAndAttachments" to work for my object's custom view page (which, funny enough, is used to override the standard view page ... but it only works if the standard view page has the related list in its page layout).

So my page has this markup:

Code:
<apex:page standardController="Email__c" extensions="CtlEmail" tabStyle="Email__c">
...
<apex:relatedList list="NotesAndAttachments" title="Attachments"/>
</apex:page>


If I remove the related list from the default page layout, I get this error:

'NotesAndAttachments' is not a valid child relationship name for entity Email

However, once I add the "Notes and Attachments" related list to the default page layout, the above markup works.

This is on an EE-class development org (test edition, specifically).
Message Edited by jhart on 12-04-2009 04:37 PM
This was selected as the best answer
kminevkminev

Case Comment visual force related list (as a key word)

 

 

 

  your post fixed my problem re-inventing the related list with vforce page and also add my custom logic.

 

Thank you

ConejoConejo

This has been broken for a year? And not fixed yet? Seriously?

 

Is there any way to find out if this is on the schedule to be addressed, or to get it bumped up in priority?

 

 

Rich C.