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.
/00Oi0000005wvrc?pv0={!Account.Id}&pv1={!Account.Type}&pv2={!Account.Key_Account__c}
But seeing as we don’t have these fields in our example we just need the first bit.
/00Oi0000005wvrc?pv0={!Account.Id}
That’s done! Report URL Hacking Complete!
Comments: