You need to sign in to do that
Don't have an account?

Related List in VF page
Hi All,
I have created two object one is Prospect__c and Second is Lead_status__c
Also I have created a Visual force Page for Prospect__c.
Lead Staus is the child object for Prospect__c.
I want to show Lead_status__c as a related detials under Prospect__c visualforce page.
Below is the code I have wrtten .
But it is giving error"'Lead_status__c' is not a valid child relationship name for entity Prospect "
<apex:page standardController="Prospect__c" cache="true" extensions="Convert" >
<br/><br/>
<apex:messages style="color:red; font-weight:bold; text-align:center;"/>
<apex:relatedList list="Lead_status__c" />
<apex:form >
<apex:pageBlock title="Prospects information" >
<apex:pageBlockButtons >
<apex:commandButton value="Delete" action="{!delete}"/>
<apex:commandButton value="Edit" action="{!edit}"/>
<apex:commandButton value="Convert" action="{!convertbutton}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Prospects Details" columns="2">
<apex:outputField value="{!Prospect__c.Salutation__c}"/>
<apex:outputField value="{!Prospect__c.First_Name__c}"/>
<apex:outputField value="{!Prospect__c.Name}"/>
<apex:outputField value="{!Prospect__c.Ownerid}"/>
<apex:outputField value="{!Prospect__c.Title__c}"/>
<apex:outputField value="{!Prospect__c.Website__c}"/>
<apex:outputField value="{!Prospect__c.Company__c}"/>
<apex:outputField value="{!Prospect__c.Rating__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Address and Contact Information">
<apex:outputField value="{!Prospect__c.Street__c}"/>
<apex:outputField value="{!Prospect__c.Email__c}"/>
<apex:outputField value="{!Prospect__c.City__c}"/>
<apex:outputField value="{!Prospect__c.Phone__c}"/>
<apex:outputField value="{!Prospect__c.State__c}"/>
<apex:outputField value="{!Prospect__c.Mobile__c}"/>
<apex:outputField value="{!Prospect__c.Pin__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Lead Source Information" columns="2">
<apex:outputField value="{!Prospect__c.Lead_Source__c}"/>
<apex:outputField value="{!Prospect__c.Promotion__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Lead Processing Information" columns="2">
<apex:outputField value="{!Prospect__c.Lead_Status__c}"/>
<apex:outputField value="{!Prospect__c.Do_Not_Call__c}"/>
<apex:outputField value="{!Prospect__c.Industry__c}"/>
<apex:outputField value="{!Prospect__c.Email_Opt_Out__c}"/>
<apex:outputField value="{!Prospect__c.No_of_Employees__c}"/>
<apex:outputField value="{!Prospect__c.Annual_Revenue__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Description" columns="2">
<apex:outputField value="{!Prospect__c.Description__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:commandLink value="Redirect to Site" style="color:blue; font-weight:bold;" action="{!RedirecttoSite}"/>
</apex:form>
</apex:page>
I have created two object one is Prospect__c and Second is Lead_status__c
Also I have created a Visual force Page for Prospect__c.
Lead Staus is the child object for Prospect__c.
I want to show Lead_status__c as a related detials under Prospect__c visualforce page.
Below is the code I have wrtten .
But it is giving error"'Lead_status__c' is not a valid child relationship name for entity Prospect "
<apex:page standardController="Prospect__c" cache="true" extensions="Convert" >
<br/><br/>
<apex:messages style="color:red; font-weight:bold; text-align:center;"/>
<apex:relatedList list="Lead_status__c" />
<apex:form >
<apex:pageBlock title="Prospects information" >
<apex:pageBlockButtons >
<apex:commandButton value="Delete" action="{!delete}"/>
<apex:commandButton value="Edit" action="{!edit}"/>
<apex:commandButton value="Convert" action="{!convertbutton}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Prospects Details" columns="2">
<apex:outputField value="{!Prospect__c.Salutation__c}"/>
<apex:outputField value="{!Prospect__c.First_Name__c}"/>
<apex:outputField value="{!Prospect__c.Name}"/>
<apex:outputField value="{!Prospect__c.Ownerid}"/>
<apex:outputField value="{!Prospect__c.Title__c}"/>
<apex:outputField value="{!Prospect__c.Website__c}"/>
<apex:outputField value="{!Prospect__c.Company__c}"/>
<apex:outputField value="{!Prospect__c.Rating__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Address and Contact Information">
<apex:outputField value="{!Prospect__c.Street__c}"/>
<apex:outputField value="{!Prospect__c.Email__c}"/>
<apex:outputField value="{!Prospect__c.City__c}"/>
<apex:outputField value="{!Prospect__c.Phone__c}"/>
<apex:outputField value="{!Prospect__c.State__c}"/>
<apex:outputField value="{!Prospect__c.Mobile__c}"/>
<apex:outputField value="{!Prospect__c.Pin__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Lead Source Information" columns="2">
<apex:outputField value="{!Prospect__c.Lead_Source__c}"/>
<apex:outputField value="{!Prospect__c.Promotion__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Lead Processing Information" columns="2">
<apex:outputField value="{!Prospect__c.Lead_Status__c}"/>
<apex:outputField value="{!Prospect__c.Do_Not_Call__c}"/>
<apex:outputField value="{!Prospect__c.Industry__c}"/>
<apex:outputField value="{!Prospect__c.Email_Opt_Out__c}"/>
<apex:outputField value="{!Prospect__c.No_of_Employees__c}"/>
<apex:outputField value="{!Prospect__c.Annual_Revenue__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Description" columns="2">
<apex:outputField value="{!Prospect__c.Description__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:commandLink value="Redirect to Site" style="color:blue; font-weight:bold;" action="{!RedirecttoSite}"/>
</apex:form>
</apex:page>
Please use child relationship name instead of child object name. Usually child relationship name is <plural name>__r for custom objects. If your child relationship name is Lead_status__r you have to write.
You may verify your child relationship name from workbench. Below is an example for child relationship contact in account object. Please check the same for your Prospect__c object.
Instead of using the name of the object in the apex:relatedList, you need to use the "Child Relationship Name".
So on your Lead_status__c object, you will probably have a master-detail to the Prospect object.
Go on that master-detail field and there you will find the "Child Relationship Name".
Use that in your relatedList.
See this screenshot: