function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Isak Stensmar 8Isak Stensmar 8 

Access Lookup value on Visualforce page

Hi,

I have a lookup relationship on a custom object which relate to itself, so it is possible that 1stObj links to 2ndObj, 2ndObj links to 3rdObj and so on.
I´m trying to access the value from the lookup field but I don´t know how to proceed and I´m not really sure how relationships works (even though I´ve read guides and other peoples solutions).

My code basically look like this where I try to access the value from the lookup field.
<apex:page standardController="MonthlyDonor__c">
    <apex:outputLink value="{!MonthlyDonor__c.Link_Objects__r.Id" title="Linked Object"> Linked Object </apex:outputLink>
MonthlyDonor is my custom Object.
Link_Objects is my Lookup field which relate to MonthlyDonor.
Link_Objects contains a MonthlyDonor ID from another MonthlyDonor.
I´ve tried using only the monhtlydonorid or __c but that does not work.
I´ve also tried to create an extension to the standardController but without any luck.
Any solutions or adivce would be greatly appriciated.

/Isak
 
Shashikant SharmaShashikant Sharma
Hi,

First it is possible to have self lookup on a object. Even native object account has a parent account.

What do you want to show on VFP, do you want to show Hierarchy ?

Thanks
Shashikant