+ Start a Discussion
Wayne_ClarkWayne_Clark 

Visualforce Apex Output Link URL to Related List Record

Hello,

 

I have a custom object (Order__c) where I've embedded a visualforce page within the page layout.  The page has an extension to retrieve a list of the related list (Stops__c).  I'm trying to create a link on the Name of the stops so the user can click the link and go to the specific record with in the related list (Stops__c), or better yet mimic the pop-up window that shows when you hoover the mouse over a lookup field.  Any ideas on how to achieve this? 

 

Below is the main code I have so far on my Visualforce page, I've managed to link it to the page, but only when I'm in the visualforce/apex edit mode with the URL is set at apex/order?id={lorder__c.Id}

 

Visualforce markup:

 

<apex:dataTable value="{!StopList}" var="STOP">

 

      <apex:column >
        <apex:facet name="header">
         <apex:outputText value="Stop Name"/>
       </apex:facet>
       <apex:outputLink value="Stops?id={!STOP.Id}" id="theLink"> {!STOP.Name} </apex:outputLink>
       <!-- Position name field is linked to the job details page -->
       </apex:column>

 

 

The link only works when I'm the visualforce edit view (visual.force.com/apex/order?id=a0kS0000000738i), but not when I'm in the normal record view (my.salesforce.com/a0kS0000000738i)  The link goes to another Visualforce page called Stops.  Any ideas on how to get this link to work in the regular record view, or also have a popup on mouseover?

 

Thanks in advance!

 

 

hitzhitz

hi,

replace ur below code
  <apex:outputLink value="Stops?id={!STOP.Id}" id="theLink"> {!STOP.Name} </apex:outputLink>

with

 

 

"<a href="Stops?id={!STOP.Id}" target="_blank">{!STOP.Name} </a>"
Wayne_ClarkWayne_Clark

Hi Hitz, it's still not working, still the same issue, it's working in the apex view, but not in the normal view.

 

When I clicked the link from the order ID: https://my.salesforce.com/a0kS0000000738i

 

It directs me to a page that says URL does not exist:  https://my.salesforce.com/servlet/Stops?id=a17S0000000mcKKIAY

 

How do I replace the "servlet" with "apex"?

Pradeep_NavatarPradeep_Navatar

Try replacing the code as given below :

 

<apex:outputLink value="/{!STOP.Id}"> {!STOP.Name} </apex:outputLink>

Burton024Burton024

Awesome, thanks!