Switch to Lightning Experience Using Apex Salesforce

By | August 28, 2017

In this post we will see how we can Switch to Lightning Experience Using Apex salesforce. When we are logged in salesforce org, then we can switch to lightning experience using UI. But what if we want to switch other users to lightning experience, so there are two ways.

  1. Individually login as all user and click on Switch to Lightning Experience : (That’s NOT a good Solution).
  2. Update all users from apex code. (That’s a Good Solution).

So what needs to be done for second option.  First see the “UserPreferencesLightningExperiencePreferred” field on  User Object. Then we need to set this field to true using code. See the code snippet below, you can execute this code from developer console.

Apex Code

Use this if you need to mass update users to switch to lightning experience.

Leave a Reply

Your email address will not be published. Required fields are marked *