passing parameters to salesforce reports

Pass parameters to a salesforce report

While creating a report of working on a project, you might have received a request to use this report as a dynamic report. That means, users will pass the filter conditions some time. You may have this question in mind at that time “how to pass parameters to a salesforce report”. I just go this question from one of the community developer. So, thought it would help someone else who might have the same query some day.

Steps to pass parameters to a salesforce report:

1. Create a report as per your requirement. Here to show you, I will use standard sample report “Opportunity Amount by Stage”. Open this report
2. Copy the URL Of the report window and past it in a notepad, you will find something similar to “https://na35.salesforce.com/00O41000001bIkh”
3. Now the trick is to identify and use the filter conditions and values to be used to render the report

Here are the parameters you can use to get a dynamic report:

  • pc0: Corresponds to the field in the report criteria.
  • pn0: Corresponds to the operator in the report criteria.
    • eq = equals
    • ne = not equals
    • lt = less than
    • le = less than or equals
    • gt = greater than
    • ge = greater than or equals
    • co = contains
    • nc = does not contain
    • sw = starts with
    • in = includes
  • pv0: Corresponds to the value in the report criteria.

So now we can modify the above url we got to the below one:

https://na35.salesforce.com/00O41000001bIkh?pc0=<FIELD NAME TO BE FILTERED ON>&pn0=<OPERATOR>&pv0=<VALUE>

https://na35.salesforce.com/00O41000001bIkh?pc0=STAGE_NAME&pn0=eq&pv0=Qualification

 

Here are the images before the parameters and after parameters:

reportwithoutparameter

 

reportwithparameter

 

Conclusion:

There is a point and click way  to get the report as well. Queries or comments are more than welcome. Keep reading and sharing as always…..


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *