That's a bit vague, so let me explain what I mean by that...
In Salesforce Classic we used to be able to launch a dashboard and inject the record Id as a filter variable, so we could use a single dashboard to show data about any suitable record we threw at it. Times were good back then!
You might want to do this if you wish to make a universal set of dashboards and let users launch them from, e.g. an Account and see all information for just that Account on the dashboard.
Then lightning came along, and STILL this is not a supported feature! Salesforce imply though in their documentation that you can still do this, they show it being done by inserting the Account name.
Great! In that case, I'll stop my post here...not so quick!
What they don't tell you is that for this to work the value you are injecting over the url has to ALREADY be a selectable value in the dashboard filter selections, and you can only have 50 entries per filter here!
Hence, a lot of people try the Name or Id and get the error "This filter URL is invalid. Please try again."
I have not found a single answer to this issue online anywhere, this is where the path disappears.
(yes for you smart arses out there I know you can add reports very easily to a record and specify them to load with the record Id as a filter and that's great, but I really want a proper dashboard!)
Salesforce directs you after some googling to use Einstein Analytics Dashboards (a paid extra) which magically supports this requirement.
So, having some time to see where the edge truly lies, I decided to go find it.
After 2 days I found it...
Let's see what we have to play with here;
- we have 3 filters that we can put 50 values into each
- we can only input these values into the filters when we launch the dashboard url - we can't put ids in here or other record values, we will get errors
- we can still feed record values into dashboard urls using the &fv0= format
So 3 filters with 50 values equals 50*50*50 = 125k combinations!
So that's the limit of this entire post! We can only use this solution if we don't expect to have a total pool of eg Accounts greater than 125,000.
(we could have more Accounts than that in total but the pool of records for use by this process has to be <=125k; for example this might only apply to Accounts that have a Gold or above rating, and so we only assign these Accounts an Id, the others we don't care about).
So what do I mean by 'assign'? All accounts have Id's! OK so we are going to create our own list of Id's and assign them to these records!
So next I will explain how we go about it.
This is the output we are going to create;
Start by creating a custom object to hold all these Id combinations in.
Next, you will need to populate records into this object. As you can see, though, our Id is actually made from 3 values joined together to make a unique string. These are the same values in the Dashboard filters, so we ensure what we send the dashboard over the url is accepted in each filter.
Now, the hard way to create all these combinations is using a flow that uses platform events and brute force to generate unique combinations. I can tell you that this is SLOW and really was just a bit of fun because...why not.
The better way is to do this using VBA and Excel. I've already created an Excel file that you can use to check out and pull the combinations from.
Your records should look something like this;
Now create a custom setting - we will use this to store which position we are in along our homemade unique Id's (we do this to reduce the query size when looking for new unique Id's to assign);
Click on manage and create a record with the name "Current Position" and the Current Position value of zero and the Position to 101.
Now on the object you want to use the dashboard from eg Account create these fields;
Now we need to create a flow to grab one of our pre-created Ids and assign it to our triggering record. In my example, I am also using Accounts as the trigger with these criteria;
and the rest of the flow.
- Query the custom setting record with the name "used position" we made and get its value (a the moment its zero)
- Query the Random Value records we created and get a record based on Position__c equals the value from query 1 above
- Update the custom setting "used position" value using a formula to +1
- Update the random value we selected and set IsUsed__c to TRUE
- Update the Account with the vars values individually (see screen shot below)
Now lets prepare the Dashboard!
Create a Dashboard and add x3 filters, the name of these filters isn't important, but they will all need to contain the values 0-9 > a-z > aa-an that we have as possible options (50 in total).
Do this for all 3 filters, as per below;
Now create on the Account (or other launch record) a url button to launch our dashboard.
Use the below url replacing the Dashboard Id only
Now add this to the page layout.
Let's test it out!
Edit an account to trigger the flow we built.
- Our edited Account should have values in the 3 custom fields we created
- Position 0 "Random Values" record IsUsed? should be set to TRUE
- Trigger another Account to make sure the above repeates and uses the next Random Value in the list
- Click on the link we added to the Dashboard
- Assuming you have a dashboard pre-configured with data you now have Account specific data!!
Try this with any Account record that you have triggered a custom Id to, and you will get new data on that dashboard relevant to that Account only!
So there we have it, you cannot use Id's any more but if your dataset either isn't over 125k records or you can restrict it to within that range then this solution will restore that lost ability without having to fork out for new products unnecessarily.
I hope others can make use of this - entire build time for this project following this post is about 4 to 8 hours.
This means you can now scale this solution to 312,500,000 combinations!
More than enough!
As yet this is untested - please let me know if you try this solution with much more than the current 3 filter 125k limit!!