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 ?

  • 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. – Thomas Taylor Apr 8 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. – SallyRothroat Apr 9 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.