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.
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.
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?
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.
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.
So in the above example if we wanted to populate each field in the filters our URL would look something like this.
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!
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?
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?
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.)
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.
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?
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.
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
Comments: