+ Start a Discussion
Harold LOPEZHarold LOPEZ 

Call a report from VisualForce for a homepage component

Hi all,

I am trying to find a way to create a VisualForce page that will be leveraged by a homepage component.

The idea is that the homepage component displays an input area where users will enter information and that after pushing on a button, Salesforce.com calls an existing report and replaces the 1st criteria of the report with the information entered by the user (this functionality currently exists in homepage components but it is my understanding that it will no longer be operational after Summer '15 release and I am then trying to figure out how to do something similar with VisualForce as per advised by Salesforce.com).

By checking a bit online I found a tutorial on YouTube (https://www.youtube.com/watch?v=8FE8gRGIGGM) explaining how to pull a report from a VisualForce. Basically some HTML should suffice for this and a sentence like this should work:

<apex:page standardController = "Account">
<a href="/5003300000nFasY?pc0=ACCOUNT_ID&pn0=eq&pv0{!LEFT(Account.ID,15)}" target="_blank"> Open Opportunities"</a>&nbsp;-&nbsp;What is the opportunity pipeline for {!Account.Name}?

If I understand this logic right:
1) Report link is /5003300000nFasY
2) The first criteria to the report is passed through ?pc0=ACCOUNT_ID&pn0=eq&pv0{!LEFT(Account.ID,15)} (this is the criteria that I need to replace with the input from the user)
3) A separate window is opening thanks to target="_blank"

This code allows displaying a report pulling data from an account record: basically I guess all I would need to figure out is the code to include an input section (to the users can enter the criteria wanted) since the <a> would work as a "button" to trigger the display of the report.

Any assistance will be more than welcome :)

Thanks in advance,

Did you find a solution to this?  I'd like to do something similar.