Print this page

User Preferences cannot be overridden during an insert of a User

Knowledge Article Number 000199049
Description When a User record is created using APEX, EmailPreferencesAutoBcc field is always defaulted to true even if you try to override it with false value.

Execute the following APEX code:

Profile p = [SELECT Id FROM Profile WHERE Name='Chatter External User']; 

User u = new User(Alias = 'standt', Email='', 
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
LocaleSidKey='en_US', ProfileId = p.Id, EmailPreferencesAutoBcc = False, 
TimeZoneSidKey='America/Los_Angeles', UserName=''); 

Insert u ; 

System.debug('**** VALUE ' + [Select EmailPreferencesAutoBcc From User Where ID 
= :].EmailPreferencesAutoBcc); 

The debug statements prints "True".
Resolution EmailPreferencesAutoBcc can be overridden and be set to false with an update operation.

promote demote