You need to sign in to do that
Don't have an account?

getParameter, VisualForce and Dashboards
Hi all, I've been programming in Apex/VisualForce for the past couple of weeks, just getting used to everything, and I've hit a bit of a roadblock.
I'm trying to generate a Google Chart from company statistics that we track and aggregate into reports and dashboards. On the particular dashboard is a very simple VisualForce page.
I'm putting some code in here, but the server continually times out when I hit Preview so I apologize if it doesn't look too good below.
I have this visualforce page:
<apex:page controller="MyStatsController" action="{!MyStatsController}">
<apex:image url="{!ReturnedURLFromController}"></apex:image>
</apex:page>
Next is my controller:
public class MyStatsController {
String ReturnedURLFromController;
List data;
public void MyStatsController()
{
String cid = System.currentPageReference().getParameters().get('cid');
Data = [Select ... where company_id =: cid ];
...
ReturnedURLFromController = GenerateChartURL();
}
public string GenerateChartURL(){
//Works on data to make the google chart url
return chart_url;
}
}
This is my problem line:
String cid = System.currentPageReference().getParameters().get('cid');
When I open the Dashboard page from a custom link, the url resembles this:
https://na2.salesforce.com/01C50000000Bds1?cid=someCompanyId
But no matter what I do, my controller is finding cid as null. I have a check after cid gets assigned and if its still NULL after the getParameter().get() call, it loads bogus data and changes the chart's title to a warning message, and this is what I get everytime.
If anyone can point me in the right direction here, I would really appreciate it.
Try with this instead
Apexpages.currentPage().getParameters().get('cid');
Hi Suma,
I have a similar issue if not fully alien.
I have visualforce page showing report data in a page block table. I want to show this page as dashboard component. Is there any way to achieve this easily? I have heard that dashboard component wont get created if you use a Standard Controller, but if you use Controller class or call/refer a page having StandardSetController Class from the concerned vf page, you may have the component available.
Could you please advise on this.
Thanks,
Vimal