+ Start a Discussion
Sarvesh PrajapatiSarvesh Prajapati 

getting error in vf as ''Reviews' is not a valid child relationship name for entity Review'

Getting error in vf as ''Reviews' is not a valid child relationship name for entity Review'.
Best Answer chosen by Sarvesh Prajapati
Mahesh DMahesh D
Mark it as solved Sarvesh.

Regards,
Mahesh

All Answers

Naval Sharma4Naval Sharma4
Hi Sarvesh,

Would you please provide litlle bit information about your object model and what do you want on vf page. It seems you are doing something wrong in understanding the relationship.

Thanks & Regards,
Naval
Sarvesh PrajapatiSarvesh Prajapati
Hi Naval,

 I have created Review and Job Application objects. I have defined a master detail relationship on Review object and relationship is named as 'Reviews' in which I have referenced Job Application.

<apex:page standardController="Review__c">
  <apex:relatedList list="Reviews"/>
</apex:page>

Let me know where is problem.

Sarvesh.
Naval Sharma4Naval Sharma4
Hi Sarvesh,

Can you try this. I think you forgot to add __r after relationship name.

<apex:page standardController="Review__c">
  <apex:relatedList list="Reviews__r"/>
</apex:page>

Let me know if you still need help.

Thanks,
Naval
Naval Sharma4Naval Sharma4

Hi Sarvesh,

Please mark this as solved if it works for you.

Thanks,

Naval

Mahesh DMahesh D
Hi Sarvesh,

Please check the below example:
 
<!-- For this example to render properly, you must associate the Visualforce page
with a valid account record in the URL.
For example, if 001D000000IRt53 is the account ID, the resulting URL should be:
https://Salesforce_instance/apex/myPage?id=001D000000IRt53
See the Visualforce Developer's Guide Quick Start Tutorial for more information. -->


<apex:page standardController="Account">
    <apex:pageBlock>
    You're looking at some related lists for {!account.name}:
    </apex:pageBlock>

    <apex:relatedList list="Opportunities" />

    <apex:relatedList list="Contacts">
        <apex:facet name="header">Titles can be overriden with facets</apex:facet>
    </apex:relatedList>

    <apex:relatedList list="Cases" title="Or you can keep the image, but change the text" />
</apex:page>

Check the below relationship:

opportunity --> Account Name, you can find the Child Relationship Name:

User-added image

Please let me know if it helps you.

Regards,
Mahesh
Sarvesh PrajapatiSarvesh Prajapati
Hi Naval

I tried using reviews__r also. But its not working.

Sarvesh.
Sarvesh PrajapatiSarvesh Prajapati
Hi Mahesh,

I did same as per your example. But its not working.
Please suggest your views.

Sarvesh.
Mahesh DMahesh D
Hi Sarvesh,

Please paste your full VF page along with Child Relationship here so that we can help you better.

Regards,
Mahesh
Sarvesh PrajapatiSarvesh Prajapati
Hi Mahesh,

<apex:page standardController="Review__c">
  <apex:relatedList list="Reviews"/>
</apex:page>

This is the only code I have. Please let me know if you need anything else.

http://C:\Sarvesh\salesforce\vf\relationship

I'm not sure if above link will for you about relationship. Please chek.

Sarvesh
Mahesh DMahesh D
It is not opening as it is pointing to your c drive.

Please upload the image by using the above button with the name "Image"

Regards,
Mahesh
Sarvesh PrajapatiSarvesh Prajapati
Hi Mahesh,

Please see below.

Relationship file
Sarvesh
Mahesh DMahesh D
Hi Sarvesh,

Please try below code:
 
<apex:page standardController="Job_Application__c">
  <apex:relatedList list="Reviews"/>
</apex:page>

Please do let me know if it helps you.

Regards,
Mahesh
Naval Sharma4Naval Sharma4
Hi Sarvesh,

If you are using custom objects then you have to find out child relationship name as Mahesh mentioned and add suffix '__r' just after the relationship name.

Let's say your child relationship name is "Reviews" then add suffix '__r' then it would be Reviews__r
Sarvesh PrajapatiSarvesh Prajapati
Hi Mahesh,

When I'm putting below ID from Job Application in address bar, I'm getting same error again.

https://c.ap2.visual.force.com/apex/accountDisplay?id=a0428000009mmay

Sarvesh.
 
Mahesh DMahesh D
Try this:
 
<apex:page standardController="Job_Application__c">
  <apex:relatedList list="Reviews__r"/>
</apex:page>

Regards,
Mahesh
Sarvesh PrajapatiSarvesh Prajapati
Hi Mahesh,

It worked. Thanks a lot for your healp!

One more help please. I'm getting error as 'Unknown property 'String.First_Name__c' at the below line.

<apex:page standardController="Job_Application__c">
  <apex:Pageblock title="My Job Application Details">
  <apex:pageblocktable value="{!Job_Application__c.Candidate__c}" var="item">
  <apex:column value="{!item.First_Name__c}"/>
  </apex:pageblocktable>
  </apex:Pageblock>
</apex:page>



Sarvesh
Sarvesh PrajapatiSarvesh Prajapati
2nd one also worked. Please ignore :)
Mahesh DMahesh D
Mark it as solved Sarvesh.

Regards,
Mahesh
This was selected as the best answer