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
Edwards71Edwards71 

Visualforce outputlink field not registering as a link

Hi,

 

I've got an apex:outputlink field linked to a records ID that I want a user to click on and open up the detailed record page. The visualforce page is rendered as a PDF.

 

The ContractNumber appears in blue on the PDF but does nothing when you click on it.

 

Any ideas why? Do I need to specifiy the salesforce URL as its rendered in PDF?

 

Thanks in advance

 

 <apex:pageBlockTable value="{!ContractListing}" var="cl" cellpadding="10" rules="all" styleclass="pageblock" >
                 <apex:column headervalue="Ref">
              <apex:outputLink value="{/!cl.id}" target="_blank">{!cl.ContractNumber}</apex:outputLink>
         </apex:column>

 

 

 

 

 

vriavmvriavm

You need to use the full record link thaan the relative link. ALso when some one clicks on the link they may be prompted to enter user name and password. If you dont want this then you have couple of options:

create a salesforce site and edit url id PDF accordingly

Provide complete url with user/pass if it is internal for your reference..

Edwards71Edwards71

Thanks - is there some dynamic code I can add to pick up the salesforce instance/URL to my code or do I have to hard code it?

 

 

vriavmvriavm

Hi,

  

    Please look at $site global variable.... {!$site.prefix} 

    Refer to : http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm

 

Edwards71Edwards71

interestingly some fields in the PDF are automatically hyperlinked just from the apex:column value alone - e.g. OwnerID, WhatID from Tasks object.  Why would some fields be auto-linked and others need to use outputlink?

 

Thanks

 <apex:pageBlockTable value="{!NotListing}" var="nl" cellpadding="10" rules="all" styleclass="pageblock" >
           <apex:column value="{!nl.ActivityDate}" />
           <apex:column value="{!nl.Subject}" />
           <apex:column value="{!nl.Description}" />
           <apex:column value="{!nl.OwnerId}" />
           <apex:column value="{!nl.WhoId}" />
           <apex:column value="{!nl.WhatId}" />

 

Edwards71Edwards71

Thanks - I've not  been able to use $page to get this sorted.

 

How do I replace https://cs11.salesforce.com (my sandbox instance which I need to it to change when published into production instance) with something dynamic?  The hard-coded example below works fine.

 

Thanks

 <apex:pageBlockTable value="{!ContractListing}" var="cl" cellpadding="10" rules="all" styleclass="pageblock" >
                 <apex:column headervalue="Ref">
              <apex:outputLink value="https://cs11.salesforce.com/{!cl.id}" target="_blank">{!cl.ContractNumber}</apex:outputLink>
         </apex:column>

 

vriavmvriavm

Yes, if it is Lookupfield or name field in object and you used outputfield then it will show as link in PDF.

 

Please read the $SIte section from salesforce documentation(Link : http://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global.htm) and use the right one for your requirement...