1

I hgave a standard new button that is overriden by a VF page, in that page's controller I am using:

    `System.debug(UserInfo.getUiThemeDisplayed());
    if(UserInfo.getUiThemeDisplayed().equals('Theme4d')){
        System.debug('Navigate to lightning component!');
     }`

to redirect to a lightning component if the user clicks this New Button(Overriden by VF) in lightning. It's not working. HERE it says that the name for lightning theme is Theme4d. But my debug yeilds Theme3?

enter image description here

The New Button is clicked here in the drop down. What's the problem here ?

2
  • Hard to say without more info (I don't see a "New" button that could be being overridden, for instance). But if the VF page is being called when the button is clicked, and UserInfo.getUiThemeDisplayed() is being called, say, in the controller's constructor, and the VF isn't Lightning-styled, then it makes sense to me that at that moment, the value is Theme3 (Classic), even if nothing has been rendered on screen yet. Maybe UserInfo.getUiTheme(), which shows the configured preference, would work better here. Apr 8, 2019 at 18:38
  • This problem eventually went away, I created a test page and it started giving the right value, not sure what I did to fix it.
    – MadMax
    Apr 9, 2019 at 15:00

0

You must log in to answer this question.

Browse other questions tagged .