+ Start a Discussion
DesaiDesai 

<apex:outputlink>

Hi,

I have built two VF pages. One VF , shows all the appointments and when the subject field is clicked, detial page is opened(2ns VF Pgae).
On this detail page we have link field Who(from events object), which is a lookup field to Contact and Lead.
Now when i click on the link, based on the value it should navigate to contact or lead detail page. How do we do it.
I tired onclick, funciton in class but its not working.
 
Martijn SchwarzerMartijn Schwarzer
Hi Pallavi,

You should point the outputlink to the relative url "/recordid", where recordid is the id of the record you want to open (the value of the field Who). That should open the record you need.

Hope this helps!

Best regards,
Martijn Schwärzer

Ps. If my answer helped you, please mark it as best answer. It will help others find best answer as well.
VidulaVidula
HI Pallavi,

You can use below code , no need to write onclick method.

           
<apex:outputLink value="/{!event.whoId}" id="theLink" target="_blank">{!event.Subject}</apex:outputLink>


OR
           
<apex:outputField value="{!event.whoId}"/>