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
SpirusSpirus 

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

Keep struggling with this issue for days.

In every custom object that has a "view" visualforce page when I try to add the 'NotesAndAttachments' as a related list I have the error "'NotesAndAttachments' is not a valid child relationship name for entity". I have added the  'NotesAndAttachments' related list to the Standard Page Layout  and I am using the following code line in the visualforce page :

 

<apex:relatedList subject="{!test__c}" list="NotesAndAttachments" />

 

Am I missing anything?

Please let me know of your thoughts.

Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan

Hi,

 

you can have the related list of notes&Attachement in Vf page, but by the follwing method,

 

<apex:page standardController="CMDData__c" tabStyle="CMDData__c">
           <apex:form >
              <apex:pageBlock title="Notes">
                    <apex:pageBlockTable value="{!CMDData__c.Notes}" var="note">
                        <apex:column value="{!note.createddate}" width="120px"/>
                        <apex:column value="{!note.createdbyid}" width="120px"/>
                        <apex:column value="{!note.body}" />
                    </apex:pageBlockTable>
                    <apex:pageBlockButtons location="top">
                        <apex:commandbutton value="Add Comment" action="/002/e?parent_id={!LEFT(CMDData__c.Id,15)}&retURL=%2Fa01i0000006QrQ9"/>  //This is the url we get when standard related list Add notes buttton is clicked. So take that and modify.
                    </apex:pageBlockButtons>
                </apex:pageBlock>
            </apex:form>
</apex:page>

 

Here CMDData__c is my custom object.

 

Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.

ledwardsledwards

I notice that your subject is a custom object. Do you something you're binding to? In order for the related lists to work on my VF pages I have to do them with controller objects.

 

public Account TempAccount {get;set;}

  

Say I have an Account page I'm writing a VF page for, my related list code looks like this, where TempAccount is the Account object that I am viewing.

 

<apex:relatedList subject="{!TempAccount}" list="NotesAndAttachments"/>

 

C. RázuriC. Rázuri

This issue seems to have been caused by the latest Version 29 that Salesforce just published. I have VF Pages with V28 and before that work fine. As soon as I upgraded those pages to V29, the problem appears.

Arunkumar.RArunkumar.R

Hi Spirus,

 

Please look on the below blog...

 

This may helpful for your Problem...

 

http://salesforcekings.blogspot.in/2013/11/view-all-your-attachment-in-visualforce.html