I would like to have a Visualforce page in a record which displays a report. I want the report to have run a query in the report based on the value of a field in the record in which it is being run.

In other word, if the Color__c field value for the record is "Red" I would like for that to be put into the criteria of the report. (ie Color__c = "Red").

Is this possible ? As it is now, I am displaying the report just by doing this :

<apex:page standardController="Custom_Object__c" >
  <analytics:reportChart reportId="00Oi0000005fPDb" >

...but I would like the field value put into the criteria dynamically.

I'm guessing this is not possible....?

1 Answer 1


You can use the filter attribute to add additional filters. A minimal change looks like this:

<apex:page standardController="Custom_Object__c" >
  <analytics:reportChart reportId="00Oi0000005fPDb" filter="[{ column:'Color__c',operator:'equals',value:'{!Custom_Object__c.Color__c}'}]">

Have a look at the documentation for more information.

  • Thank you so much. Is it also possible to show the body of the report with a filter ? All I am able to find are methods of iframe such as this : <apex:page standardController="Custom_Object__c" > <apex:iframe src="/00O900000020jcA"/> <!—Report id --> </apex:page> But I don't think I can apply a filter to that, can I ?
    – Zoom_v
    Jul 3, 2019 at 4:54
  • 1
    @Zoom_v No, that wouldn't work, but you could use the ReportManager class to run a report with additional filters and render your own data table.
    – sfdcfox
    Jul 3, 2019 at 13:11

You must log in to answer this question.

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