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

Visualforce Apex Output Link URL to Related List Record



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:outputLink value="Stops?id={!STOP.Id}" id="theLink"> {!STOP.Name} </apex:outputLink>
       <!-- Position name field is linked to the job details page -->



The link only works when I'm the visualforce edit view (, but not when I'm in the normal record view (  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!





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




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

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:


It directs me to a page that says URL does not exist:


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


Try replacing the code as given below :


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


Awesome, thanks!