Report Links in Lightning Experience

Reports Links in Classic with filters will not work in lightning properly. Let’s have a look on below image. This link basically navigate users to a report and applies a filter

Coming to lightning, a click on the link from the record page will navigate users to report but filters will not get applied. So, How to fix it in Lightning?

Replace Custom Link with a formula field

A formula field of type hyperlink where URL will be defined based on the user theme i.e. Classic or Lightning.

$User.UITheme– Gives you the information about users current theme. i.e. weather user is in Classic or Lightning. If it returns Theme4d, it is Lightning and if it returns Theme3, it is Classic.

Read more about Theme detection in Salesforce here:-

Our formula field will look like below. It will work fine in both classic and Lightning.

IF( $User.UITheme == 'Theme4d',
HYPERLINK("/lightning/r/00O580000022P95/view?fv0="& ParentId , "Account Team Report"),
HYPERLINK("/00O580000022P95?pv0="& ParentId , "Account Team Report"))

Once you add the field on the page layout, remove the report custom link from page layout as formula field will work both in classic and Lightning.

Also, To pass filter parameter in classic, use pv0 whereas use fv0 in Lightning.

fv0 — The fv stands for “filter value,” and is the name of the parameter. The 0 is the numerical order in which the filter appears in the report. (The first filter is 0, the second filter is 1, the third is 2, and so forth.) Standard filters don’t count in this order, and can’t be filtered using URL parameters, although they appear as the first three filters on any report. To set the value of the fifth filter in the report, specify fv4. Read more here:-

Note:- If you try the same with Link using URLFOR to generate URL based on theme instead of formula field will not work properly for you in Lightning. $User.UITheme does not return the correct theme when used inside link. It is a known issue from Salesforce.

Leave a Reply