+ Start a Discussion
kevindotcarkevindotcar 

Display opportunity name as a link in a VF page

 

Hi everybody,

 

I'd like to display a link to an opportunity object in my VF page rather than just the name, but all my efforts seem to be thwarted.  I tried displaying the oppy name as an "OutputLink" tag, and  "{!oppy.Opportunity}" but those didn't work.   My markup for the section in question is;

 

  <apex:pageBlock title="Standard Sales">
    <apex:dataTable value="{!oli_s}" var="oppy" id="detail_s" width="800px" >
        <apex:column width="25%">
            <apex:facet name="header">Name</apex:facet>
            <apex:outputText value="{!oppy.Opportunity.Name}"/>
        </apex:column>

 

Any help is appreciated-

 

Best Answer chosen by Admin (Salesforce Developers) 
kevindotcarkevindotcar

 

Well, I came up with a solution -

I changed the

 

<apex:outputText value="{!oppy.Opportunity.Name}"/>

...to:

<apex:commandLink action="/{!oppy.Opportunity.Id}" value="{!oppy.Opportunity.Name}"/>

But now my question is the slash in the ""/{!oppy.Opportunity.Id}" part --

If I take it out, the page doesn't compile. 

 

It appears to be some sort of syntactic thing that I can't find any information on - other than assuming it means "take the following object Id to be a link" -  I looked in the merge-field syntax doc and couldn't find any reference to building a command link with a "/" on the object name.

 

but I'd like to know if there's a link to other syntax trick for apex tags that aren't documented in the VF developer's guide.