0

I have an formula field with HYPERLINK to an VF Page below is the Formula Field code

IF (TEXT(<fld name>) ==  'something', HYPERLINK('/apex/page-name?param1=5&id='+Id, MY BUTTON IMAGE,'_self'), NULL)

The above code generates URL as below (when i see using inspect element)

https://{instance-name}.lightning.force.com/apex/page-name?param1=abc&id=

But on layout when i click on image it redirects to below URL

https://<instance>--c.cs78.visual.force.com/apex/page-name?param1=abc&id=<sf-id>

Can someone explain why is this behaviour.

Thanks

  • If you're on lightning UI, it would be common as first it would try to open the page in Lightning domain followed by in Classic. – Raul Apr 19 '18 at 8:08
  • any solution for this... because if we redirect to a VF page from a Lightning component, it opens up in lightning UI – sfdeveloper Apr 19 '18 at 11:25
  • What's the problem with that? – Raul Apr 19 '18 at 12:06
  • problem is only with url within formula, it doesn't work as redirect work within lightning component – sfdeveloper Apr 19 '18 at 12:58
-1

Lightning and classic url is different. to resolve this condition on redirected page you can use this script as a reference.

"script" if(typeof sforce !== 'undefined' && sforce !== null && '{!$User.UIThemeDisplayed}' === 'Theme4d'){ sforce.one.navigateToURL('{!'/one/one.app#/ }'); } else { window.top.location = '{!'/}'; } "/script"

Hope this helps !!

  • how this would work in formula field ?? – sfdeveloper Apr 19 '18 at 11:22
  • formula field you are using to redirecting to vf page is fine. you can write that script to redirect to lightning mode instead of classic one. i don't think you can achieve this by formula. – devendra shekhawat Apr 19 '18 at 11:34

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.