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
bharthibharthi 

Hyperlink to a VF Pdf page

Hi Guys,

 

Ok here is what i am trying to achieve, I have a roll up summary of the following data from an object called Call report Vehicles and this data is displayed on another Object Call Report:

 

Vehicles due for service : 2

Vehicles due for term : 6

Services missed : 10

 

and so on..

 

I created the above in the Call report, then i added a button to email the above summary in pdf to a sales rep. I also added to this supporting pdf's which is detailed summary of the above listing for example services missed - all the vehicles and their details.

 

When i email the Pdf's there is no issues and if i add it as a custom link(https://VehicleServicesMissed?id=a07P0000000mUXZ) there is no issues but custom links were not looking neat and tidy hence we went with hyperlinks.

 

the issue arises when i create a new section on Call Report to have hyperlinks to these pdf's (i tried to do a hyperlink on the summary values but failed) so i decided to go the route of hyperlinks however if i create a hyperlink and used the path from the custom link like the one below it worked for one record as the "a07P0000000mUXZ" references a specific call report.

 

How do i change the hyperlink below so if i access the link from call report 1,2 OR 3 the data that would be represented would be for that call report. I suspect i need to do some sort of id record match but since im new to salesforce i am absolutely clueless.

https:///VehicleServicesMissed?id=a07P0000000mUXZ

 

 

any help would be greatly appreciated.

 

Bharthi Ramsewak

 

 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bharthibharthi

Hi Reid,

 

I found out where i went wrong. Thanks for your help!

 

I needed to compare the current id value with the record id value

 

HYPERLINK("https://apex/VehicleServicesMissed?Id="+ Id, "View")

 

The above link worked 100%. Where i stated that the id must equal Current id.

 

Many thanks,

Bharthi

All Answers

ReidCReidC

Do you have the ID hard coded in the link?  If so, you need to remove that and use the Apex:Param method.

 

You end up with something like this:

 

<apex:outputLink value="http://google.com/search">
Search Google
<apex:param name="q" value="{!account.name}"/>
</apex:outputLink>

Check here:

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_query_params_setting.htm#kanchor156

bharthibharthi

Hi Reid,

 

the hyperlink is the following :

 

HYPERLINK("https://apex/VehicleServicesMissed?&=Call_Report__c.Name", "View")

 

I see the pdf but my contents are blank. The VF page is displayed but the results from the apex code is not been displayed.

 

if i remove the = Call_Report_c.Name and use an actual call report id eg 0001frfxcu it works for that record. I need to take out the hard coded 0001frfxcu and replace this with a dynamic value of which i am unsure of.

 

thanks

bharthi

ReidCReidC

Is this hyperlink a formula field?

bharthibharthi

Hi Reid,

 

Yes it is a Formula Field.

 

regards,

Bharthi

ReidCReidC

Where is the ID you want to send as a parameter?  Is it the record ID of the current page?  If so, your formula will look like this:

 

HYPERLINK('http://google.com?id='+ Id , 'Search on google')

 

If it's a field other than ID, a lookup to a custom object, it will look like this:

 

HYPERLINK('http://google.com?id='+ MyCustomLookup__c , 'Search on google')

 

In the formula field definition area, you can select the "advanced" tab and then the insert field button.  The screen then looks like the attached screenshot.

 

HTH

 

edit: fixed type-o

bharthibharthi

Thanks Reid,

 

I see now that i have changed the formula field to :

HYPERLINK("https://c.cs4.visual.force.com/apex/VehicleServicesMissed?"+Id, "View")

 

 

I can see that everytime i go to a new Call report the id in the pdf link changes. This is great.. However, yes there is but to this...

 

The pdf does not pull through any data.. the page generates the layout but not the data.

 

if i email myself the PDF's i get all the data.

 

Any clues on this?

bharthibharthi

Hi Reid,

 

I found out where i went wrong. Thanks for your help!

 

I needed to compare the current id value with the record id value

 

HYPERLINK("https://apex/VehicleServicesMissed?Id="+ Id, "View")

 

The above link worked 100%. Where i stated that the id must equal Current id.

 

Many thanks,

Bharthi

This was selected as the best answer
ReidCReidC

Exactly it!  Glad you are up and running.