In this implementation, we will implement the functionality to filter Dashboard from URL Parameters. Sometimes we need to open the Dashboard by clicking on a button and filter the Dashboard with predefined parameters. This post will help to filter the dashboard using the URL parameters. This feature is the new feature introduced in Spring ’21 Release.
Let’s hop into the implementation.
In this implementation, we will create a Dashboard and then filter the dashboard with the URL parameters.
Create any report and add it in Dashboard. I have created a report to display Accounts and grouped the rows by Type. Then create a Dashboard and add the report as a component in the Dashboard.
The Dashboard would look something like this:
Also, notice the URL of Dashboard, it should look something like this:
Also, I have added a filter in this Dashboard on the Rating field with values Hot, Warm and Cold.
Filter Dashboard from URL Parameters
We need to follow the below structure in order to filter the dashboard by passing URL parameters.
- ? : If there is no ? in the URL, we need to add to pass the URL paramerters.
- &fv0 : The fv stands for filter value. fv0 represents the first filter value, fv1 represents the second filter value and so on.
- = : The separator bewteen the fv (filter value) and actual value that we are passing to the filter. The parameter value must be URI encoded.
So, if we want to filter the Dashboard to show only Accounts with Rating Hot, we need to append the below string to the Dashboard URL:
This is how the complete URL would look like:
And this is how our filtered Dashboard would look like:
We can create such URLs to filter Dashboard with different values.
We need to consider the below limitations while filtering the Dashboards:
- We can only pass String values from URL parameters.
- Only supports equals operator.
- The filter value that we pass must be included in the Dashboard filter values provided.
- You can atmost assign one value per filter.
- You can’t delete filters from dashboards with filter value URL parameters. Setting a blank value filters by no text or numerals, but doesn’t remove the filter.
- Filtering Dashboard from URL is not supported in Salesforce Classic.
That is all from this post. If you don’t want to miss new implementations, please Subscribe here.
If you want to know more about this, check the official documentation here.