2

I want to create a custom link to navigate to a report mentioned based on the parameter passed to it but for creating a custom link which navigates to a report in Classic we need to pass the parameter as '?pv0=' but in lightning the parameters need to be in the format of '?fv0='.

Is there any work around or do i need to create two custom links?

2

Parameterized report links designed for Classic do not work in Lightning, and those designed for Lightning do not work in Classic.

There's a solution for hyperlink formula fields, but it doesn't work for Custom Links. To make a hyperlink formula field work in both environments, you embed a formula expression that looks at the $User.UIThemeDisplayed context variable, which is "Theme4d" on Lightning. The formula can then conditionally render a link that works for Lightning or for Classic. (Here's a fuller explication, not by me).

Unfortunately, applying this solution to Custom Links just plain doesn't work - fields and text that are merged into a Custom Link from a formula expression are URL-escaped, which destroys the link if you try something like

{! IF($User.UIThemeDisplayed="Theme4d",
"/lightning/r/Report/MY_ID/view?fv0=" & Account.Id ,
"/MY_ID?pv0="& Account.Id ) }

This just yields

You have sent us an Illegal URL or an improperly formatted request.

%2F00O0b000005xXXXXXX%3Fpv0%3D0010b00002XXXXX

(Note the URL escaping).

I've tried a number of routes around this but haven't found anything that actually works.

The delivered Idea for parameterized report links in Lightning suggests that this situation will probably not be fixed:

Current solution in Classic is not changing, but it was something we never officially supported.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.