• Yemi Roti Olanbiwonnu
  • NEWBIE
  • 10 Points
  • Member since 2018
  • Salesforce Developer
  • Univar

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am having an issue with detecting lightning in our Production environment.

We have a redirect VF page that is overriding the edit action of one of our custom objects. The controller for this VF page does a check for lightning by checking UserInfo.getUiThemeDisplayed(). However, for some reason, the org is only returning Theme3 at the moment. I tested in a dev console, and typing in
System.debug( 'UI Theme displayed: ' + UserInfo.getUiThemeDisplayed() );
results in Theme3, regardless of whether I am running that anonymous code in Classic or LEX. I assume this is due to a weird quirk with the developer console. But the VF page is giving me the same response.

I am aware of a current bug with the UserInfo.getUiTheme[Displayed] functions that cannot detect the actual page the User is viewing. It only looks at the setting. For example, if the user clicks the link to switch back to Classic, but then opens a link that is specifically for lightning (eg hostname.my.salesforce.com/lightning/r/Account/[id]/view), it will open that link in the LEX context. But getUiTheme and getUiThemeDisplayed will still think that the page is in Classic since the User's setting is set to Classic. However, that bug is not what is happening here for me.

In my current situation, even if I click the "switch to lightning experience" link, it still continues to show Theme3 for getUiThemeDisplayed. I know we can detect lightning by checking the URL, but I'd rather avoid that hacky and unstable workaround.

Has anyone else experienced this kind of behavior and could give me some insights as to what is happening?

Somthing else that may be important to know is that I am currently unable to reproduce this in my dev org or any of our Sandboxes at the moment.
I am having an issue with detecting lightning in our Production environment.

We have a redirect VF page that is overriding the edit action of one of our custom objects. The controller for this VF page does a check for lightning by checking UserInfo.getUiThemeDisplayed(). However, for some reason, the org is only returning Theme3 at the moment. I tested in a dev console, and typing in
System.debug( 'UI Theme displayed: ' + UserInfo.getUiThemeDisplayed() );
results in Theme3, regardless of whether I am running that anonymous code in Classic or LEX. I assume this is due to a weird quirk with the developer console. But the VF page is giving me the same response.

I am aware of a current bug with the UserInfo.getUiTheme[Displayed] functions that cannot detect the actual page the User is viewing. It only looks at the setting. For example, if the user clicks the link to switch back to Classic, but then opens a link that is specifically for lightning (eg hostname.my.salesforce.com/lightning/r/Account/[id]/view), it will open that link in the LEX context. But getUiTheme and getUiThemeDisplayed will still think that the page is in Classic since the User's setting is set to Classic. However, that bug is not what is happening here for me.

In my current situation, even if I click the "switch to lightning experience" link, it still continues to show Theme3 for getUiThemeDisplayed. I know we can detect lightning by checking the URL, but I'd rather avoid that hacky and unstable workaround.

Has anyone else experienced this kind of behavior and could give me some insights as to what is happening?

Somthing else that may be important to know is that I am currently unable to reproduce this in my dev org or any of our Sandboxes at the moment.