Skip to content

Instantly share code, notes, and snippets.

@hasanthaera
Created April 23, 2015 06:31
Show Gist options
  • Save hasanthaera/6499299886c540234873 to your computer and use it in GitHub Desktop.
Save hasanthaera/6499299886c540234873 to your computer and use it in GitHub Desktop.
Salesforce - Mass Update saleforce1 mobile field with APEX
/**
* Author: Hasantha Liyanage
* Created: 2014-12-15
* Summary: This will update the UserPreferencesHideS1BrowserUI field and make the Salesforce1 User
* field on User object false
**/
// get the users who does not have salesforce1 mobile feature enabled
List<User> users = [
SELECT
Id,
IsActive,
UserPreferencesHideS1BrowserUI
FROM User
WHERE
IsActive = true
AND
UserPreferencesHideS1BrowserUI = false
];
// make the users salesforce 1 mobile fetaure disabled individually
for(User user : users){
user.UserPreferencesHideS1BrowserUI = true;
}
update users;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment