How to change report criteria dynamically in Salesforce?

How to change report criteria dynamically in Salesforce?

To change report criteria dynamically in Salesforce, we have to pass the filter criteria in the URL.

Follow the below steps to change report criteria dynamically in Salesforce

1. Create a report with conditions null or blank.

2. Create a Visualforce page.

<apex:page>
<apex:form >
    <apex:pageBlock >
        <apex:commandButton 
			value="Show Report" 
			onclick="window.open('/00O90000005L3b6?pv0=Karnataka&pv1=Mysore', '_SELF');"/>
    </apex:pageBlock>
</apex:form>
</apex:page>

here 00O90000005L3b6 is the id of the report.

3. When you click Show Report button, below is the output of the report

Leave a Reply