Passing Parameters To a Report Through The URL

One of the most powerful features of Salesforce is the ability to consolidate all of the information in your organization into easy to digest reports and dashboards. Users with the ability to create reports will find all of the functionality they need on the Reports tab. Anyone who has worked with Reports before can testify that the feature is very powerful and provides the user with quick insight into their information. The question now becomes, how do I make this information even easier to obtain?

Let’s take a look at a specific scenario. Suppose you work for a company, ABC Products, and ABC Products has a multitude of accounts with open cases at any given time. As the administrator for your Salesforce org, you have received multiple requests to generate a report for your Support Reps to display an account’s open cases at any given point. You take a look at your Support Reports folder and realize that you have no Cases By Account report currently created.

No Cases By Account report

You decide to go ahead and create that report yourself. First, you start off by creating a custom report type, since Accounts with Cases is not a valid report type by default. Under the Create -> Report Type, click New Custom Report Type. You will create the report type based on accounts and then add Cases as the child object. By default, all of the fields should be selected.

Step One: Create Report Type
Step Two: Create Report Type

Now that we have our custom report type, let’s go ahead and make our report. Navigate to the Report tab and click New Report. Select the Accounts with Cases report type under the Customer Support Reports folder.

Select Report Type

You make the report relatively simple, you want to show all open cases in a tabular format with all relevant information a rep needs. It would look something like:

Initial Report Structure

So, this is great so far. However, as you might have noticed, this is going to show all open cases across all accounts. Unfortunately, ABC Products has dedicated support assigned to specific accounts and the reps want to be able to view each account specific cases. So, we need to add a filter. The logical filter is the Salesforce Id. Unfortunately, for the standard user, being able to grab an account’s Salesforce Id, then adding it as part of the filter query, and then inserting it into the report filter is unreasonable. ABC Products Support Reps simply don’t have time for that. The better solution is to provide a link to the report from an Account’s page layout that automatically filters based on that account.

The first thing we are going to want to do is add a filter to an Account ID on our report but leave the field blank. We will use this field in our link to the report.

Report with No Account Id

Next thing we are going to want to do is add a link in the Custom Links section of the Account page layout. First, we need to create that link. Under Customize -> Accounts -> Buttons, Links, or Actions we will create a New Button or Link. We want this as a Detail Page Link so we can add it to the Custom Links section of the Account page layout. To add the report as a link, we will need to know the report ID. As with any object in Salesforce, we can link directly to it with just a backslash + ID (/{recordId}). In the case of the Cases by Account report, that link is:


Note: As suggested above, you can find the ID by looking at the URL and taking the trailing value after the slash. The report above is The important part is after the .com, or the /00Oi0000002zzhr

Another extremely important thing to note is that this ID is org specific. This means that if you create this link in a sandbox, it will not work once deployed to production.

So, we have a link to our report, but that still doesn’t handle passing a parameter to the report. So, how do we do that? Well, reports have a specific set of URL parameters. To add a parameter to the first filtered field of your report, you set it as:


The important thing to note is the structure. It is pv (which I assume stands for paramValue), the number of the paramValue with a zero based index (so the first filter criteria is 0, second is 1, third is 2, etc…). You then add the = with the value you want it assigned with.

Let’s take a look at how this relates to our example with ABC Products. The final URL will be:


Final URL for Custom Link

Notice how I was able to utilize the {!Account.Id} merge field and that I assigned it to the second parameter passed in by using pv1. You can now go ahead and safely add that link to your page layout under the Custom Links section. When I click the link on the Edge Communications account (ID: 001i000000KodWl), you will see the following:

Finalized Report

There we go! We were able to successfully add a dynamic parameter to a report by passing the value through the URL. In the future, if we want to pass multiple dynamic variables, we can chain the paramValues together using the & symbol. For instance, this would be a valid URL passing in the first three filter criteria of a report:


By utilizing this process, we have made a report for ABC Products’ Support Reps that is accessible per account through a single click.

Note: There are a few downsides to this approach. First of all, this isn’t sanctioned by Salesforce and it could break at any moment (although it hasn’t in the multitude of years I have worked on Salesforce). This tactic also doesn’t work with Joined Reports. As with any unsanctioned workaround, proceed at your own risk. Good luck!

15 Responses to “Passing Parameters To a Report Through The URL”

  1. Stephanie
    December 3, 2013 at 5:21 pm #

    Thank you, Jesse. This was very helpful to me. I know how to write urls with parameter passing for other situations, but everything I’d found so far for report filter parameters assumed I already knew what pv0, etc. were referencing. Thanks again!

  2. Squire
    May 23, 2014 at 4:13 pm #

    THIS. This right here. This just saved me a boatload of time and effort. I had a request to replicate a report multiple times so that a user could run the “ABC Account” and the “XYZ Account” reports whenever they wanted, without using the filter.


  3. Sandeep
    May 30, 2014 at 1:27 am #

    Thanks ,
    How to handle below mentioned issue .
    “Another extremely important thing to note is that this ID is org specific. This means that if you create this link in a sandbox, it will not work once deployed to production. ”

    As mentioned by you the ReportID will be changed ? So If I deploy my change in Dev box , Do I need to redo this Sandbox/Prd box??

    • Sandeep
      May 30, 2014 at 1:28 am #

      Thanks ,
      How to handle below mentioned issue .
      “Another extremely important thing to note is that this ID is org specific. This means that if you create this link in a sandbox, it will not work once deployed to production. ”

      As mentioned by you the ReportID will not* be changed ? So If I deploy my change in Dev box , Do I need to redo this Sandbox/Prd box??

  4. Sudha Vishwakarma
    September 30, 2014 at 9:30 am #

    Hey jesse, that was really something new and very useful to me right now.

    You said in the note:this isn’t sanctioned by Salesforce . What does this mean?

    • April 9, 2015 at 8:32 am #

      What I meant by that is that Salesforce can choose to change any of this functionality at any time with little to no warning. It is not guaranteed to work like traditional functionality.

  5. George
    January 6, 2015 at 5:52 pm #

    This is awesome. Fits perfectly as a business solution in our org…thanks!

  6. T Brown
    April 8, 2015 at 8:38 pm #

    Hi Jesse – Great post. Super helpful.

    Do you know if there is anyway to only include the field in the filter criteria in the report if the field is populated on the Object itself? IE I have 4 fields. The first 2 will always be populated. 3 and 4 might not be populated. I only want to include fields 3 and 4 in the report if they are populated. Can I use an IF statement (or something similar) in the link to conditionally include fields 3 and 4 in the report based on the field being populated? Or any other trick to do this?


  7. Aish
    April 14, 2015 at 5:28 am #

    Hi Jesse,

    It is such a nice article,But here my requirement is to open this report in Salesforce 1. I am still trying but couldn’t get any solution. Is there any way to open this report on salesforce 1.

    Any help is much appreciated!!

  8. Kenneth Ray
    May 29, 2015 at 3:47 pm #


  9. July 13, 2016 at 9:21 am #

    hello Jesse, thanks for this post is very clear. I have trying this but still can’t make it work if I try to filter by a standar field (custom object). How do I identify the field id if the field is Name. If I go to the field properties I do not have an Id to look at. At least It did not work what i tried.
    This is de link to de Name field of the custom object.

    I am using this URL to get the filtered report, but it does not filter anything:


  10. July 13, 2016 at 9:31 am #

    I found the solution. I was not including on the report the filter Name = “”
    I was trying to pass the filetr by ID pc0, pn0 and pv0.

    Not it works perfectly, Thanks again!

  11. bob
    January 30, 2017 at 4:23 pm #

    Happened upon this page while searching for a solution. I know about the pv# fields for filters, but is there a way to interact with the conditions for those filters? Instead of what is configured (i.e. contains), to use “starts with”, etc? Thanx!

  12. Ramesh
    February 15, 2017 at 5:24 am #

    Its working fine in salesforce classic view but not working in lightning view

Leave a Comment