Admins / Users

URL Hacking for Salesforce Dashboards (Preset Salesforce Dashboard Filters)

By Ines Garcia

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

Yet, up to Spring ‘21, you couldn’t navigate to a dashboard with filters already set. Well, there’s good news here, thanks to an idea created in the IdeaExchange 9 years ago with 18260 points and 6 merged ideas, this feature was finally delivered.

Now, anyone has the ability to open a dashboard with a filter set by the URL, removing the need to clone, replicate or have multiple dashboards.

How Salesforce Dashboard URL Hacking Works

In essence, it’s quite simple, you have to set the filter variable in the URL. There are a few parts to understand:

The Filter

The first important thing to note is that the filter values added to your URL must refer to the filters you have applied to the dashboard – you cannot reference fields as filters if they are not already added as a filter to the dashboard.

Each filter on your dashboard is an fv, which stands for Filter Value – easy to remember!

As you can have multiple filters, each filter also has a numerical value. So your first filter is fv0, your second filter is fv1 and your third filter is fv2.

After the fv value you will add = to set what the filter value is equal to, for example, if your filter is a picklist, you will enter the picklist value you wish to filter by.

In the screenshot below, you can see we are filtering by our our second dashboard filter fv1=.

The Value

Once you have set which filter it is, it’s time to add what value you are filtering by.

In our example we are filtering to only show closed cases.

So, we’ll update our filter to fv1=Closed.

Remember the values must match the available dashboard filter values!

The Spaces

You may have seen sometimes when copying URLs you find %20 as part of it, that’s simply the way to add a ‘space’ between words.

Putting it into context of our example if we wanted to filter by cases with status of In Progress the value would be In%20Progress.

The Link

Similarly to formulas and excel, to conglomerate values you add ‘&’ between statements, so to add a filter to your URL, you’ll add & before your first fv value.

In our example below, you can use the dashboard URL, then add & then the filter fv1= and lastly the value ‘by’.

If you had a second filter to add, you will again add an & then the filter and value.

What features aren’t yet supported?

Whilst playing around with this little feature I’ve noticed that it does not render dynamic dates. Even when set in the dashboard filters, using parameters such as TODAY or Last%20Month results in the following error:

From looking at the original idea:

“We have a standard dashboard for all Marketing Campaigns which can be filtered by each specific campaign to show general progress & statistics. On the Campaign object we would have a formula field which would link to the dashboard passing the ID of the campaign to the filter.

When viewing a campaign, users would then easily be able to jump to the campaign dashboard to see real-time statistics on the progress of the campaign.”

This sent me on an excursion to try! My findings suggest the functionality of filters in dashboards hadn’t really changed. They are explicit, you need to set the specific value. So for the use case described in the original idea they would have to set an ID or name of campaign per each permutation.

As there is always more than one way to achieve something, today you can overcome this with embedding specific reports and filtering on the Account ID. It’s not the whole dashboard, but it’s a start and it’s within the record context. Something like below:

So for the use case, in the original idea, this could have a tab within the page with some of the reports the dashboard uses and filtered by Campaign ID of the record the user is at.

Summary

As a famous UK slogan goes “every little helps”. Since the Spring ‘21 release we now have this little gem, giving us the ability to add filter parameters to the end of a dashboard URL. Have a play with it.

With the prediction that in mind, I think we will continue seeing enhancements on the ability of parsing parameters over the URL within the application. We’ll have to keep a close eye, until then, what’s on your wish list for this? Pop it in the comments section!

The Author

Ines Garcia

Ines Garcia founder of www.getagile.co.uk , is an Agile Coach, Certified Scrum Professional (CSP®-SM) and a Salesforce MVP, together helps organisations to become more agile.

Comments:

    Fiona
    July 21, 2021 9:04 pm
    Thanks Ines for stepping through each part of the URL and explaining each part - very useful Thanks
    Isabel
    August 26, 2022 12:07 pm
    HI! Is it possible then to create a filter based on campaign id? In the article is it said “We have a standard dashboard for all Marketing Campaigns which can be filtered by each specific campaign to show general progress & statistics" I am trying to do so but as it is mandatory to enter a value in the camapign id filter, when I try to do the url hacking with another Id I get an error saying that the filter URL is invalid. Thanks!
    Tobias
    January 30, 2023 1:09 pm
    As this post alludes to I really wouldn't call this feature delivered - not delivered as expected, at least. For those wanting to pass a record id into a dashboard and also for some information on what is and what is not supported I have written a blog post detailing all here https://salesforceconfig.com/show-any-accounts-data-on-a-universal-dashboard/
    Tobias
    January 30, 2023 1:10 pm
    The issue is that the filter value you are passing HAS to be a pre-defined selectable value in the dashboard filter(s). You can not pass in anything you please. I have created a reasonable solution (there are scaling limits) to this issue if you want to check it out on my blog here https://salesforceconfig.com/show-any-accounts-data-on-a-universal-dashboard/

Leave a Reply