3

This Salesforce Documentation suggests that we can detect which User Interface is being displayed by using the $User.UITheme and $User.UIThemeDisplayed global variables and the UserInfo.getUiTheme() and the UserInfo.getUiThemeDisplayed() Apex methods. In my org, I have enabled the Lightning experience for my user and switched over to the new UI. However, when I try to detect the interface using either in Visualforce using the global variables on through the Developer Console using the Apex methods, it keeps returning 'Theme3' and not 'Theme4d' as is expected. Has anyone else run into this issue? Are there more steps to Enable Lightning that I'm missing?

3
  • I know getUiTheme() return the "preferred" theme. But getUiThemeDisplayed must display the current one? Otherwise you could check if sforce.one is available in Javascript.
    – brovasi
    Commented Aug 31, 2016 at 22:43
  • This was user error. I had Lightning Enabled, but I was checking the $User.UITheme and $User.UIThemeDisplayed whiled in Classic Mode. Commented Sep 1, 2016 at 2:11
  • @SuryatejMukkamalla Do you want to answer your own question with a description of what the problem was? Commented Sep 6, 2016 at 21:15

1 Answer 1

2

This was just user error on my part. Although I had Lightning enabled, I had not switched to it when I was trying to detect the UI Theme. Once I switched to the Lightning view, it was detecting the UI Theme correctly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .