title: How do I output hyperlinks for Custom Object name fields in an apex:PageBlockTable
body: <p>Sounds easy enough, but I'm taking the values output in my table from a number of field sets, so admin users can customise the columns that appear in the table.</p>
  
  <p>Here's my functioning page block...</p>
  
  <pre><code>        &lt;apex:pageBlock title="{!$Label.Search_Results}"&gt;
          &lt;apex:pageBlockTable value="{!SearchResults}" var="pictureGallerySearchResult" title="SearchResults"&gt;
              &lt;apex:column headerValue="Image" styleClass="imageDataCell"&gt;
                  &lt;a target="_blank" href="/servlet/servlet.FileDownload?file={!pictureGallerySearchResult.ActualAttachment.Id}" &gt;
                      &lt;img class="searchResultImage" style="{!SearchResultsImageStyle}" src="/servlet/servlet.FileDownload?file={!pictureGallerySearchResult.ActualAttachment.Id}" alt="{!pictureGallerySearchResult.ActualAttachment.Name}"/&gt;
                  &lt;/a&gt;
              &lt;/apex:column&gt;
              &lt;apex:column headerValue="Test" value="{!pictureGallerySearchResult.Project[pictureGallerySearchResultField]}"/&gt;
              &lt;apex:repeat value="{!$ObjectType.Project__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField"&gt;
                  &lt;apex:column headerValue="{!$ObjectType.Project__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Project[pictureGallerySearchResultField]}"/&gt;
              &lt;/apex:repeat&gt;              
              &lt;apex:repeat value="{!$ObjectType.Store__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField"&gt;
                  &lt;apex:column headerValue="{!$ObjectType.Store__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Store[pictureGallerySearchResultField]}"/&gt;
              &lt;/apex:repeat&gt;
              &lt;apex:repeat value="{!$ObjectType.Visit__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField"&gt;
                  &lt;apex:column headerValue="{!$ObjectType.Visit__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.Visit[pictureGallerySearchResultField]}"/&gt;
              &lt;/apex:repeat&gt;
              &lt;apex:repeat value="{!$ObjectType.Photo_Attachment__c.FieldSets.Picture_Gallery_Search_Results}" var="pictureGallerySearchResultField"&gt;
                  &lt;apex:column headerValue="{!$ObjectType.Photo_Attachment__c.Fields[pictureGallerySearchResultField].label}" value="{!pictureGallerySearchResult.PhotoAttachment[pictureGallerySearchResultField]}"/&gt;
              &lt;/apex:repeat&gt;
          &lt;/apex:pageBlockTable&gt;
      &lt;/apex:pageBlock&gt;
  </code></pre>
  
  <p>You can see I've created a 'hard-coded' hyperlink for an image in the first column, but I want to dynamically hyperlink a field, if it is the name field for a custom object.</p>
  
  <p>For example, if the fieldset...</p>
  
  <pre><code>$ObjectType.Project__c.FieldSets.Picture_Gallery_Search_Results
  </code></pre>
  
  <p>...contains the a field called 'Name', I want to insert a hyperlink that would take you to the salesforce page to view that project.</p>
  
  <p>So firstly I need to be able to determine if the field is a custom object name field and secondly, output a hyper link rather than a label.</p>
  
  <p>If anyone has any ideas, I would be most appreciative.</p>
  
  <p>Thanks for taking the time to read this.</p>