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
Lukasz PiziakLukasz Piziak 

How to add Hyperlink in Visualforce page on BlockTable?

Hi,

How I can change my record name PRO-00139 as a hyperlink on my pageBlockTable to be able to click on this name and open record?
I'm really new to the Visualforce page and any help would be appreciated.

Screenshot
Best Answer chosen by Lukasz Piziak
Shashi PatowaryShashi Patowary
Hi Lukasz,

You can use something link this -
 
<apex:page standardController="Account">
  <apex:pageBlock >
    <apex:pageBlockTable value="{!Account}" var="acc">
      <apex:column headerValue="Name">
       <apex:outputLink value="/{!acc.id}" target="_blank">
       Name
       </apex:outputLink>
      </apex:column>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:page>
Please change the value 'target' based on your requirement whether to open the new page in the same window or in a new tab.This target value '_blank' will open the new page in a new tab.

Please let me know if it helps.

Regrads,
Shashi
 

All Answers

Shashi PatowaryShashi Patowary
Hi Lukasz,

You can use something link this -
 
<apex:page standardController="Account">
  <apex:pageBlock >
    <apex:pageBlockTable value="{!Account}" var="acc">
      <apex:column headerValue="Name">
       <apex:outputLink value="/{!acc.id}" target="_blank">
       Name
       </apex:outputLink>
      </apex:column>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:page>
Please change the value 'target' based on your requirement whether to open the new page in the same window or in a new tab.This target value '_blank' will open the new page in a new tab.

Please let me know if it helps.

Regrads,
Shashi
 
This was selected as the best answer
Atul GuptaAtul Gupta
++ Shashi
Abhishek BansalAbhishek Bansal
Hi Lukasz,

Please change your last time shown in the screenshot with the below code :
<apex:column headerValue="Production Order No." style="width:100px">
	<apex:outputLink value="/{!item.id}" target="_blank">
    	{!item.Name}
    </apex:outputLink>
</apex:column>
That will help you to achieve what you want.
Let me know if you need more help on this.

Thanks,
Abhishek
Lukasz PiziakLukasz Piziak
thanks Abhishek and Shashi, its working for me now.