Passing record id via Link to Visualforce detail page
apex-code, salesforce, visualforce
Solution
You can do it just like this:
<apex:outputLink value="/apex/customDetailPage?id={!opportunity.id}">
{!opportunity.Name}
</apex:outputLink>
Assuming that your custom page checks for the `id` parameter to establish which record it should be working with.
You can also use the `$Page` global variable option as described here which should mean it'll look something like this:
<apex:outputLink value="{!$Page.customDetailPage}?id={!opportunity.id}">
{!opportunity.Name}
</apex:outputLink>
Problem
``` <apex:outputLink value="/!{opportunity.id}">{!opportunity.Name}</apex:outputLink> ``` I am creating 2 pages in VF. One page to display a list of custom object records from a dynamic search. This is complete. I need to now create a custom VF page to display a single record information when a user clicks on a link on the list page. I know we can use an output link like the one shown above. Assuming I have built the detail page (assume its path is "apex/customDetailPage"), how would I go about modifying this link. Because my detail page will need the selected record id passed to it I suppose.