Quick win 2: Troubleshoot Your VF Page with lightning Styles enabled stopped working!

When using lightningStylesheets on a Visualforce page in Lightning Experience, the page can be displayed with Classic styling for some users. This behavior is normal and can be adjusted using the steps below.


Visualforce pages using lightningStylesheets=”true” and that display with Classic styling in Lightning Experience are a result of the UserPreferencesLightningExperiencePreferred field for the user experiencing the behavior. In order to check the value for that field on a User record, you can use the following steps.

  • As a System Admin user, run the following query in the Developer Console or Workbench: SELECT UserPreferencesLightningExperiencePreferred, Id, Username FROM User where id = ‘userId’
  • Check if the result of the query shows the UserPreferencesLightningExperiencePreferred field value as “false”
  • When the field value is false, Visualforce pages with lightningStylesheets=”true” will use Classic styling in Lightning Experience

This field value will usually change when users use the Lightning Experience Switcher to change between Salesforce Classic and Lightning Experience. If the user’s Profile has the “Hide Option to Switch to Salesforce Classic” permission enabled, you will need to use the Salesforce Dataloader or a similar tool to update their User record to update their preferred UI experience.

Issue because of this:

run this in anonymous block and refresh your visualforce page — SOLVED !

Note: Remember Visual force does not always respect your lightningStylesheets = true.