+ Start a Discussion

How Can I Display Record Names on a VF page, so that a user can Click it and open it in Sales Force

So, I have a custom report I have built in Visual Force. I am trying to display the record name so that if a user wants to, they can click it, which will then allow them to open the record in SalesForce.


I have the similar functionality for Lookup fields.. I have a field called "Owner," which is a lookup to a SalesForce user.

I also have a field entitled "Customer" which looks up an Account on Salesforce.


On my VisualForce page, I display these two fields as:

<apex:repeat value="{!records}" var="a">
<TR><TD width="9%"><apex:outputField value="{!a.Owner__c}" /></TD>
<TD width="9%"><apex:outputField value="{!a.Customer__c}" /></TD></TR></apex:repeat>

 When these two fields are displayed, they are underlined, and I am able to click them and open up the corresponding Account Object or User Object in SalesForce. I wish to do the same for the Record Name.


I tried using:

<TD width="9%"><apex:outputField value="{!a.Name}" /></TD>

 However, this only displays the text, and it does not provide a link to the record. Is there a way I can enable the record name to be clicked in order to open the record in SalesForce?





Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Change it to output link




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


All Answers

Shashikant SharmaShashikant Sharma

Change it to output link




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


This was selected as the best answer

Thanks, Shashikant. That was it!


I had tried the outputLink tag but was putting {!a.name} as the value instead of /{!a.id}

Shashikant SharmaShashikant Sharma

Your welcome Michael3.Brown,


You asked about Round givind you exponential for 9.5 and 9.5 ,


please check my reply on it. Let me know if any issues in it.