Salesforce Reports URL Hack (Preset Report Filters)

By Ben McCarthy

An Admin favorite feature that wasn’t technically developed by Salesforce was “URL hacking”; the ability to parse over URL parameters for setting field/filter values, which is now supported in Lightning Experience.

Reports URL Hacking means users can open a report with filters values set automatically by the URL parameters, removing the need to clone, replicate or have multiple reports.

Screen Shot 2015-02-09 at 13.05.37

Even though its not obvious. These three filters, Account ID, Stage and Key Account are just fields on this page. This means just like my email hack tutorial we can insert information here via the URL. 

For this example I’m going to be creating a report that grabs all of the open opportunities for a specified account.

Step 1 – Creating the Template Report

The first step of this URL hack is to actually create the report we want to use in this solution. The key to this part is to create a report like you normally would but leaving the filters that you wish to populate via the URL, Blank.

Screen Shot 2015-02-09 at 13.52.04

As you can see from the above its a pretty simple report. I’ve left the Account ID blank as we want to populate this to only get the Opps related to the account were working off. I’ve made the Stage filter static as this is going to be the same every time.

Next we need to save this report and grab the ID which you can find in the URL bar after you save. After the .com/ and before the /e?

Screen Shot 2015-02-09 at 13.54.23

Step 3 – Creating the Button/Link

After we’ve got our Report ID for our template Report we are ready to create our Button or Link, for this example I’m going to be creating a link. You want to make sure you have your Report ID handy for this step.

Go to your relevant object and create a new link. It should look similar to mine below. After you have entered the Display Type, Behavior and Content Source, you can copy you report URL with a forward slash into the text area.

Screen Shot 2015-02-09 at 13.57.38

This button so far will launch your blank template report, so lets add this to your page layout and then add some parameters!

Step 3 – Adding Report Parameters

I mentioned earlier that the filters on a report are just fields that can be manipulated and populated. These fields always have the same parameter values no matter what they are. Pv stands for parameter value and the code we need look like this pv0= for the first filter, pv1= for the second and pv2= for the third.

Screen Shot 2015-02-09 at 13.05.37

So in the above example if we wanted to populate each field in the filters our URL would look something like this.


But seeing as we don’t have these fields in our example we just need the first bit.


That’s done! Report URL Hacking Complete!

The Author

Ben McCarthy

Ben is the Founder of Salesforce Ben. He also works as a Non-Exec Director & Advisor for various companies within the Salesforce Ecosystem.


    February 14, 2015 8:12 pm
    Christopher B
    August 13, 2015 9:14 pm
    Hi, Any suggestions for creating links to reports where the filters relate to the user clicking the link? Scenario: My users need to see where their name is listed in a lookup field to the user ID. I created a report and followed your instructions. Report Filter: Lead Broker: User ID equals "" Custom Link: /00Oo0000004WlM9?pv0={!User.Id} It inserts the text - {!User.Id} which of course returns no results. I'm at a loss, any help would be appreciated. Not sure if it matters, but the report is related to a custom object. Thanks!
    Ben McCarthy
    August 13, 2015 9:31 pm
    Hi Christopher, so the only thing which is different here to something normal is that user is a global variable. However I tried this out myself and it works fine. This is my exact link URL - /00Oi0000005xrvZ?pv0={!$User.FirstName}+{!$User.LastName} It works fine, are you launching thing off a link then?
    April 23, 2016 6:28 am
    I'm looking to push the limits. I know we can dynically pass field values, filter logic, and I believe operators, but is it possible to dynamically pass fields? Ex. From oppty record type "A" we want to see pv0 as acct = (dynamic value) and for oppty record type "B" we see pv0 as owner = (dynamic value). Envision a report with 15 filters that say ID null and we pass the field, operator, value, and filter logic dynamically and use 1 report per CRT to rule them all. What can and can't we do?
    December 18, 2016 7:47 pm
    Hi Ben, Is there a way to avoid hardcoding the Report ID in the Custom Link URL?
    Repair Manuals
    January 03, 2017 11:10 am
    If you are going for finest contents like I do, only go to see this website all the time as it gives feature contents, thanks
    January 16, 2017 10:42 pm
    Does this url hack work for lightning as well? How can you pass parameters via custom link/button to generate Dynamic reports on lightning?
    tech air stratford ct
    April 15, 2017 4:52 am
    I don't usually comment but I gotta say thank you for the post on this perfect one : D.
    April 26, 2018 4:21 am
    Relojes Digitales Fashion de Diseño a buen precio.
    July 30, 2018 6:59 pm
    Hi Ben, this is a great article! However, when I follow the instructions and grab the report ID as you've specified Next we need to save this report and grab the ID which you can find in the URL bar after you save. After the .com/ and before the /e?), after I configure the button and click on it, it pulls up the report in edit view, not as though it has just been run. Here is what I have listed as the button url "/00O3F000000****?pv0={!FX5__Job__c.ID__c}". (The asterisks are actual characters.)
    nike air max
    November 18, 2018 9:48 pm
    I simply desired to say thanks once again. I am not sure what I would've done without those basics shared by you directly on such a industry. It previously was the depressing issue for me, nevertheless taking note of the very skilled strategy you dealt with it forced me to leap over delight. I am grateful for this help and as well , hope that you know what an amazing job you were carrying out educating others through your website. Probably you haven't come across all of us.
    Matt Hammel
    July 24, 2019 7:04 pm
    Hi, we have account names that contain commas. When I pass the account name to the report, salesforce separates the criteria into two searches. Is there a way to put the account name in quotes and then pass it to the report?
    Matt Hammel
    July 24, 2019 7:24 pm
    I figured it out. I updated the formula to read: ={! '"'&Account.Ultimate_Parent_Name_ID__c&'"' } I put quote marks inside single quote marks and then concatenated them to the field value using & in before and after the field name.
    September 22, 2020 5:30 pm
    Hi Ben, Can we use the same by using a Dashboard? I want Dashboard on the object record page with all details for that particular record. Kindly guide if this is possible? Thanks Neha
    raul ramos
    February 18, 2021 1:26 pm
    Hello, Can I do this with a joined report?

Leave a Reply