3
    https://example--dev.lightning.force.com/lightning/page/home?0.source=alohaHeader

This is the URL and I want to capture only

     https://example--dev.lightning.force.com/lightning

in a custom formula field.

2
  • URL can be changed anytime, is there a use case? Commented Nov 16, 2018 at 19:05
  • Yes, I want to append the URL to open a report in Lightning. But can this part of the URL be captured?
    – VChandra
    Commented Nov 16, 2018 at 19:14

1 Answer 1

3

You dont have to capture a URL for that, just create a formula field of type text and provide the hyperlink URL as, where first parameter is the report id. It will open the report in same tab/window

HYPERLINK('/00O58000002mRTN', 'Open Report ','_self')

Src: https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&type=5

11
  • You can avoid the awkward _classic/ URL-translation redirect by using the native Lightning URL, like /lightning/r/Report/MY_ID/view.
    – David Reed
    Commented Nov 16, 2018 at 19:25
  • Apparently for me, it still opens the report in lightning, without any tweaks Commented Nov 16, 2018 at 19:25
  • Huh. Interesting. I get a quick flash in the URL bar of a redirect through /_classic/someID before it resolves the Lightning URL. I wonder if that's context-dependent.
    – David Reed
    Commented Nov 16, 2018 at 19:27
  • Probably if you have switched to lightning, it puts a cookie in your browser, so that even classic url are redirected to lighting. Commented Nov 16, 2018 at 19:28
  • 1
    That bit is important, can you edit the question and provide details like you are using lightning components. Using lightning components you can capture the URL, store in database and so much more. Also if you can post the code that you have tried would also help us from reinventing the wheel and reach solution faster. Commented Nov 16, 2018 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .