Thank you!
Pam,
I realized I posted this in a similar thread - https://trailhead.salesforce.com/trailblazer-community/users/0053A00000Ecy3xQAB/feed?lang=en&tab=answers
Here is a script I wrote to deactivate the BCC field for all Users - sets EmailPreferencesAutoBcc = false.
In our Org there are 5 "System Users" which failed to update because they were read only. However the other 2500 updated without issue.
list<User> users = [
Select id, EmailPreferencesAutoBcc
From User
where EmailPreferencesAutoBcc=true];
for (User a : users ){
a.EmailPreferencesAutoBcc = false;
}
System.debug('Users Updated: ' + users.size() );
Database.SaveResult[] srList = Database.update(users, false);
// Iterate through each returned result
for (Database.SaveResult sr : srList) {
if (!sr.isSuccess()) {
// Operation failed, so get all errors
for(Database.Error err : sr.getErrors()) {
System.debug('The following error has occurred.');
System.debug(err.getStatusCode() + ': ' + err.getMessage());
}
}
}