How to Create a Link or Button that Sends You to a Dynamic Salesforce Report



1) Go to setup –> object manager –> Account (with respect to object)

2) Click on Button, Links, and Actions. Click on ‘New Button or Link’.

3) Enter into the Label field what you want the custom link/button to be called. 

4) Optional to enter in the Description field, a brief summary of what the link/button will represent. 

5) Should you choose to create a button, select ‘Detail Page Button’ on the display type field. 

(**Go into details about link option)

6) Select your ‘Behavior’ options as necessary, in this case, ‘Display in a new window’ was selected. 

7) Select ‘Content Source’ to be URL and open up a new tab to proceed with step 8. 

8) In a new tab, go to your Salesforce report you created and make sure it is created off of a report type that includes both objects funds, and accounts (data must be structured where both objects have a relationship to each other, e.g. account is lookup field on fund level; or fund is a related list on account) to allow you to bring in the necessary field that will be filtered on per step 9. Group by rows the ‘Account Name’ field to allow you to visualize your data per Account and all the funds associated with that account. 

9) Add a field filter to the report to include an ‘Account ID’ field set to ‘equal to’ blank (leave the input cell blank). Also, make sure to leave the ‘locked’ checkbox unchecked so the parameter is able to pass the account ID into this report filter to dynamically show you the data from the specific account record you are viewing. Copy and paste the URL of your Salesforce report up through the ‘https://….view?’;. 

10) If you go back to the custom button/link you were editing, you’ll paste the URL you copied from step 10 of the Salesforce report into that textbox. 

11) Add ‘fv0={!Account.Id}’ to the end of that URL link you pasted from step 10. 

**If the Account ID field is the 1st field you added as a filter to the report, use fv0 as indicated(Salesforce by default will add two field filters into all Salesforce reports and so the third field added is considered fv0, the 4th field added as a filter is considered fv1, etc). So wherever you decide to add the ‘Account ID’ filter in your report, specify the fv# that you’ll copy and paste into the custom button/link you create. 

-Best practice is to use the ‘Select Field Type’ dropdown and select the object(account).

-Click on ‘Insert Field’ and select ‘Account ID’ which will populate the merge field. 

12) Click ‘Check Syntax’ to ensure the code/link runs without any syntax errors in merge fields or functions. Hit Save. 

13) Go to the object (Account) page layout you are wanting this button to be visible on via setup and add the newly created button from the ‘Mobile & Lightning Actions’ to the ‘Salesforce Mobile and Lightning Experience Actions section of the layout. Save the page layout. 

14) Now if you go to an account record you should see your ‘Fund Summary’ button and if you click on it, you will see the funds (and other fields you included in the report) associated with the specific account.