Steps
- Go to Setup –> Object Manager –> Account (with respect to object)
- Click on Button, Links, and Actions. Click on ‘New Button or Link’.
- Enter into the Label field what you want the custom link/button to be called.
- Optional to enter in the Description field, a brief summary of what the link/button will represent.
- Should you choose to create a button, select ‘Detail Page Button’ on the display type field.
- (**The ‘Detail Page Link’ option will only show under custom links on a ‘Detail’ section of the object.)
- Select your ‘Behavior’ options as necessary, in this case, ‘Display in a new window’ was selected.
- Select ‘Content Source’ to be URL and open up a new tab to proceed with step 8.
- In a new tab, go to the Salesforce report you created and make sure it is created off of a report type that includes both object’s 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.
- 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?’;.
- 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.
- 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 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.
- The 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.
- Click ‘Check Syntax’ to ensure the code/link runs without any syntax errors in merge fields or functions. Hit Save.
- Go to the object (Account) page layout you want this button/link to be visible on via setup. For the button, add the newly created button from the ‘Mobile & Lightning Actions’ to the ‘Salesforce Mobile and Lightning Experience Actions’ section of the layout. For the link, add the newly created link from the ‘Custom Links’ to the ‘Custom Links’ section of the layout. Save the page layout.
- Now if you go to an account record you should see your ‘Fund Summary’ button or if you added a custom link, you will locate this in the ‘Details’ section of the record. Once you click on the link/button, you will see the funds (and other fields you included in the report) associated with the specific account.