You need to sign in to do that
Don't have an account?
mtbdays
Retrieving values through a field of type reference
Is it possible to retreive values from the referenced object of a field that is a lookup field on another object (ie. the datatype of the field is reference)?
My situation is: I created a custom field on Opportunity called product__c that is a lookup field to Products. In my Visualforce page, I can retrieve the Product name, but I want to retrieve the product ID too. In the schema browser, I can see that in the Opportunity object, there is a custome field called product__c which has a reference to the Product2 object, and I see the Product2 fields under it, but I can not seem to retreive it in the Visualforce page.
I tried: <apex:outputField value="{!Opportunity.Product__c.Product2.Id}"/> but got an error.
Thanks
if you use outputText (or no component at all, just the expression {!Opportunity.Product__c} ), it should give you what you need. I think you can also refer to the relationship using __r, so something like {!Opportunity.Product__r.id}.