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?
-
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.– brovasiCommented 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.– Suryatej MukkamallaCommented Sep 1, 2016 at 2:11
-
@SuryatejMukkamalla Do you want to answer your own question with a description of what the problem was?– Daniel BallingerCommented Sep 6, 2016 at 21:15
Add a comment
|
1 Answer
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.