0

I am trying to add a link to redirect from opportunity page to a vfp page. There are two pages one for classic and one for lightning. I want to add two links. If user is in classic mode one button will show and for lightning the other button will show. Is it possible with javascript or apex?

James Z
  • 12,209
  • 10
  • 24
  • 44
Hasan Zubairi
  • 1,037
  • 4
  • 23
  • 57

1 Answers1

0

I would suggest using a Detail page button to redirect on your page. After creating your button you can edit the page layout and add your newly created button to both lightning and classic page layout enter image description here I think that for your use case 2 buttons are needed, one to redirect in lightning and one to redirect in classic.

Otherwise, if you want to have a conditional link with Javascript you can try something like(I have never tested this though, so I'm not sure it's working):

if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
     // Do something for Lightning Experience
} else {
    // Use classic Visualforce
}