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
RelaxItsJustCodeRelaxItsJustCode 

Making vf page clickable..... Please help

This is the VF page

<apex:page standardController="Contact" extensions="sampleDetailPageCon"> <style> .fewerMore { display: none;} </style> <apex:form > <apex:pageMessages /> <apex:detail relatedList="true"></apex:detail> <apex:pageblock id="CustomList" title="Related Opportunities" > <apex:pageBlockTable value="{!oppz}" var="o" rendered="{!NOT(ISNULL(oppz))}"> <apex:column value="{!o.Name}"/> <apex:column value="{!o.Account.Name}"/> <apex:column value="{!o.Type}"/> <apex:column value="{!o.Amount}"></apex:column> <apex:column value="{!o.CloseDate}"/> </apex:pageBlockTable> <apex:outputLabel value="No records to display" rendered="{!(ISNULL(oppz))}" styleClass="noRowsHeader"></apex:outputLabel> </apex:pageblock> </apex:form> </apex:page>

 

This is the class that drive it.

public class sampleDetailPageCon {    
    private List<Opportunity> oppz;    
    private Contact cntact;     
    public sampleDetailPageCon(ApexPages.StandardController controller) {        
        this.cntact= (Contact)controller.getRecord();    
        }    
        public List<Opportunity> getOppz()    
        {        
            Contact con = [Select id, Account.id FROM Contact where id = :cntact.id];        
            if (con.Account == null)         
                return null;        
                oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity where Account.id = :con.Account.id];        
                return oppz;    
        }
}

 

Visually, it is cool but basic.  How do I many the Opportunity data in the related list clickable?  Please help I will give kudos..

 

Thank you,

Steve Laycock

Best Answer chosen by Admin (Salesforce Developers) 
Maros SitkoMaros Sitko

Try inseted

<apex:column value="{!o.Name}"/> 

 this one (open in new tab, you can remove target="_blank" to open in the same window

<apex:column>
 <a href="/{!o.id}" target="_blank">{!o.Name}"</a>
</apex:column>

 

 or use pure VF tags (the same result)

<apex:column>
 <apex:outputLink value="/{!o.id}">{!o.Name}</apex:outputLink>
</apex:column>