I am trying to generate a report in Lightning with the help of custom link on the Contract. Thought of using the url hack like classic by adding the parameters but no luck in generating the report with the help of custom link through this approach. I tried to use the same custom link to generate reports in LEX as well as classic depending on the user.
Below are the options tried for genrating the report:
Option-1: Provided Full url to the custom link
https://org62--mydev.lightning.force.com/one/one.app#/sObject/00O30000002NnM7/view?fv4= {!Contract.ContractNumber}
This is working fine but needs to give Full URL and If i move to another sandbox this is failing and requires a change in every environment.
Also tried giving only this in the custom link -
/one/one.app#/sObject/00O30000002NnM7/view?fv4= {!Contract.ContractNumber}
--> WORKING ALL TIMES
/00O30000002NnM7?pv4={!Contract.ContractNumber}
--> WORKING IN CLASSIC but in LEX it's not displaying the report
Option-2: I used a condition to differentiate between classic and LEX user using the Theme and tried to use the URL but no luck.
IF($User.UIThemeDisplayed=='Theme4d',
'/one/one.app#/sObject/00O30000002NnM7/view?fv4=',
'/00O30000002NnM7?&pv4=')
{!Contract.ContractNumber}
)
When I do this I am getting an error as below: Illegal URL assignment
Can anyone help me on the Option-2 as I can differentiate between classic and LEX user and direct to the correct URL?