You need to sign in to do that
Don't have an account?
getting an error message while craeting Vpage
Hi ,
I am trying to create a sample visual page with recruitment application but when i try to show fields data from related list, I am getting the following error.
Error: Invalid field Job_application__r for SObject Position__c |
here is my code.
<apex:page standardController="Position__c" id="thePage">
<apex:form >
<apex:pageBlock >
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!save}" value="Save"></apex:commandButton>
<apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Position__c.Department__c}">
</apex:inputField>
<apex:inputField value="{!Position__c.Job_Description__c}">
</apex:inputField>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock>
<apex:pageblockTable value="{!Position__c.Job_application__r}" var="JA">
<apex:column value="{!JA.Candidate__c}">
</apex:column>
<apex:column value="{!JA.Candidate_Qualified__c}">
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I just ran into this same thing while following the examples in the Force.com Developer Guide in Chapter 9.
In my case, the related list isn't called "Job_Application__r". It's some long number. Here's how I found it:
1. Go to Setup | Create | Objects
2. Select the Job Application custom object
3. Under "Custom Fields and Relationships", select Position
4. You should see four (4) sections within "Custom Field Definition Detail":
5. Under "Master-Detail Options", to the right of Related To Position you should see Child Relationship Name.
In my case, that Child Relationship Name says R00N30000002btlAEAQ.
So I changed my VF code to say this:
<apex:pageblockTable value="{!Position__c.R00N30000002btlAEAQ__r}" var="JA" title="Job Applications">
Also, for me Candidate is the same way.
Hope this helps.
Charlie
All Answers
Try checking with your WSDL to confirm if the field does exist.... I would recommend checking the WSDL whenever you face this error
Cheers!!
I just ran into this same thing while following the examples in the Force.com Developer Guide in Chapter 9.
In my case, the related list isn't called "Job_Application__r". It's some long number. Here's how I found it:
1. Go to Setup | Create | Objects
2. Select the Job Application custom object
3. Under "Custom Fields and Relationships", select Position
4. You should see four (4) sections within "Custom Field Definition Detail":
5. Under "Master-Detail Options", to the right of Related To Position you should see Child Relationship Name.
In my case, that Child Relationship Name says R00N30000002btlAEAQ.
So I changed my VF code to say this:
<apex:pageblockTable value="{!Position__c.R00N30000002btlAEAQ__r}" var="JA" title="Job Applications">
Also, for me Candidate is the same way.
Hope this helps.
Charlie
Thanks Charlie !!!, This was quite helpful.