Use Visualforce in Classic and Lightning Experience

Same Visualforce in classic and Lightning
Same Visualforce in classic and Lightning

This topic was subset of my presentation in Salesforce Boston World Tour 2017. Sometimes we find our-self in situation where custom Visualforce page should be displayed with Old theme in classic but with Lightning theme in Lightning Experience.

If you can convince client to use same user interface in classic and Lightning, then it would be an ideal approach. Even Salesforce displays classic user interface for many setup pages inside Lightning experience.

If client does not agree, then we simply need to detect that in which context Visualforce is running and then enable or disable the section as per UIThemeDisplayed global variable as shown in below Apex code snippet.


  1. Hi Jitendra, I’d rather had the same question posted on your previous blog too. Which is from where you bind the filterId, listViewOptions variables are bind to in standard controllers? and there’s init(); method too. But i couldn’t find the implementation. Please help me to understand the concept here

    Many thanks,

  2. Can you please help me on the lookup field UI change? once the VF page has been changed to match Lightning UI, if you click on any of the lookup fields on that VF page then it still opens in classic UI.

Leave a comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.