So far as I've searched, this isn't possible, but any suggestions would be appreciated.

I'd like to be able to link to an organization's Storage Usage screen from the UI of my external application, but the paths for the screen are different for SFDC lightning and SFDC classic. The paths don't redirect properly, so it's difficult to know which to present. If I'm able to detect that an org is enabled for lightning, I'd be able to always expose the correct path in my UI.

Ultimately I'm trying to help users quickly find how many leads or contacts they have to estimate a process that will run on my side with their data.

  • Even if Org is enabled for ligtning, its ultimately user's choice to switch to ligtning or SF Classic – Pranay Jaiswal Jul 19 '16 at 15:19

Try the UserPreferencesLightningExperiencePreferred field on the User object. Should accurately reflect if an individual user has Lightning enabled.

If you want to see if an entire org has Lightning enabled at all, I think you could safely determine that by checking if the count of users that have UserPreferencesLightningExperiencePreferred set to true is greater than 0.

  • Don't think this is correct - if you disable LEX user preference still stays at LEX - it doesn't get downgraded to Classic. – dzh Apr 1 '19 at 4:04

You can use UserInfo.UIThemeDisplayed() method in the Apex class to find the Current Theme Displayed (LEX or Classic View). More info about the Theme Detection can be found here

Also a trailhead module with more info can be found here

  • This won't work if user wanna check from external application – Pranay Jaiswal Jul 19 '16 at 15:15

Your Answer

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

Not the answer you're looking for?Browse other questions tagged or ask your own question.