Adaptal

Create a Salesforce Hyperlink Formula Field to a Filtered Report

Best Practice

Create a Salesforce Hyperlink Formula Field 3
Overview

Sometimes we want to have a link on an object’s record page to to click on in order to access a report or external website. We also want to see the content of the report relevant only to the specific record without having to adjust filters every time. 

In this article, it will demonstrate:

  • How to create the report’s filter(s) and obtain the URL for a Report.
  • How to edit the URL to adjust filter(s) dynamically.
  • How to create the formula field on the relevant object for the link.
  • How to create a link to access an external website.

Setting up Report and Filter(s):

  • Go to an existing report / create a new report for the relevant object.
  • Make sure the relevant filter(s) are applied. For example, an object called Engagement are linked to multiple Invoices. We want to create a link on the Engagement record, which will take us to a report that shows only the Invoices linked to that Engagement record. We thus need to have a filter for Engagement ID.
  • Salesforce Hyperlink Formula Field,
  • The Engagement ID filter can be left blank as it will change dynamically with the formula field link.
  • Make sure the Engagement ID is the first custom filter because this will affect how the URL needs to be edit.
  • After clicking save, you can obtain the original URL of the report by opening the report again (i.e. clicking on the report tab and select the report).

Edit URL of Report

  • Append &fv0=Filter Value to the end of the report’s URL, substituting your parameters.
    • For fv0, substitute 0 for the numerical order in which the filter appears in the report.
      The first filter is 0, the second filter is 1, and so on. For example, to set the value of the fifth filter in the report, specify fv4. You can’t filter standard filters with URL parameters, and they don’t count in this order.

Create Formula Field (the link) on Relevant Object for the Report:

  • In the field creation, select Formula field and the return type Text.
  • Use the Hyperlink function. Example below: I don’t 
  • SzsqdXk64nXvboEugS6BLoEugS6BLoEugS6BNYrgf8PajZf0z54PCEAAAAASUVORK5CYII=
  • The “Id” (pointed by the red arrow) is a merge field for the Engagement object Record ID. We added it to the end of the filter “&fv0=” to use the Record ID as the filter value for the Report.
  • After saving, you can go to the a record page to test out the new formula field created, see example below:
    • h9hHkWLDKWJkgAAAABJRU5ErkJggg==

Create Formula Field (the link) on Relevant Object for External Website:

  • Similar to a Report, adjust the URL components of the website with merge fields accordingly to create the specific weblink. Example below:
    • 8vh+wiZnyjsAAAAASUVORK5CYII=