0

I have attempted to place an analytics:reportchart into my visualforce page inside apex:tab. After some research i found that this is currently not possible (https://help.salesforce.com/apex/HTViewSolution?id=000212701&language=en_US)

In the resolution, it says to create a visualforce page, place the chart inside then call it with an iframe.

The issue I have here is that I need to place a filter on the report chart with the AccountID. The report needs to be dynamic and apply for whatever the account is currently on.

I have a controller that collects the account ID as follows:

AccountId = ApexPages.CurrentPage().getParameters().get('Id'); Is there a way to place a filter on the report and call with an iframe?

1 Answer 1

0

This answer isn't specific to using it within an iframe; assuming the filter setting is your only problem then you already have that sorted.

To place a filter on the report, you need to have a column in your report for the field you want to filter on. Getting the name of the column is a bit tricksy and I haven't found any good documentation on it. The Salesforce docs say use the API name of the field. I can't quite grasp the rules to know how to piece that name together but as an example from a working VF page that I have, the name of the filter field is Sales_Data__c.Account__c.Id, where the report I am using is based on the Sales_Data__c custom object and I am referencing the related Account Id field (apparently unlike references in formulas etc, you do not change the __c to __r when you reference related fields).

While the column you are filtering on needs to be in your report, it does not need to be defined as a filter and it does not need to be part of the chart you are showing. You might have a tabular report with two groupings: one is for your filter and the other is what you actually put in your chart.

Once you have set up the report correctly, here's an example of setting the filter on your VF page:

<analytics:reportChart developerName="my_report" 
    filter="[{column:'Sales_Data__c.Account__c.Id',
    operator:'equals', value:'{!AccountId}'}]"/> 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .