I have a Custom Object that has a reference to Opportunities, I originally had it set up with a Master-Detail relationship but then after reading this and noting that parent objects can't be referenced, as well as the Master-Detail relationship only storing the ID, I switched the field type to a LookUp one.
So now my object's custom field's datatype is: Lookup(Opportunity)
and I'm trying to make a VisualForce page that uses the StandardController (with reference to my custom object) render the name of the Opportunity. But the relationship doesn't seem to work and I just get unknown property String.name
when I try. Can someone point me in the right direction?
Here's a bit of sample code:
<apex:page standardController="CustomObj__c" recordSetVar="objs">
<apex:pageBlock title="">
<apex:pageBlockTable value="{! objs}" var="item" >
<apex:column headerValue="Opp. Name">
<apex:outputText value="{! item.opp_to_exp__c.Name}"/>
</apex:column>
<apex:column headerValue="Opportunity">
<apex:outputText value="{! item.opp_to_exp__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
So opp_to_exp__c
is API name for the field, and I've ripped out the specifics of the names and such besides that API name. I have no trouble rendering the other fields up of the object, just this lookUp one it seems.
The error message suggests to me that the opp_to_exp__c
is still just a String for some reason even though I've changed the data type to be a LookUp one.
Can anyone help? I've spent over a few hours reading documentation and trying to find the right KeyTerms to search for on here with no avail.