Is it possible to display the reports and dashboards in the visual force page? If yes, can anybody provide me with some reference.
There are multiple ways to do this.
This is the easiest way probably.
You can specify the report ID and it pretty much takes care of the rest. It also comes with a refresh button.
To fetch the private reports shown on the private dashboard, you need to do a few query.
Get the Dashboard ID using UserInfo.getUserId()
SELECT Id FROM Dashboard where FolderId = :UserInfo.getUserId() LIMIT 1
Once you have the dashboardId, fetch its report components using another query:
SELECT CustomReportId,DashboardId FROM DashboardComponent where DashboardId = :dashboardId
You could fire both the query in a single SOQL:
SELECT CustomReportId,DashboardId FROM DashboardComponent where DashboardId IN (select ID FROM Dashboard where FolderId = :UserInfo.getUserId())
So all the
CustomReportId returned in the last query will be your list of report IDs to be passed on to
You could do this in that way: