Updating the “Set default event reminders to” or any other User Setting for multiple Users.
Scenario:
While creating an Event or Task in Salesforce, the “Reminder” Checkbox is checked by default for all users. The reminders have piled up and making it difficult to keep track of the important events and tasks. The Sales team wants you to uncheck the “Set default event reminders to” Checkbox for all users.
This setting is found in:
My Settings >> Calendar and Reminders >> Activity Reminders >> ‘Set default event reminders to’
Solution:
This can be achieved by updating the User Object using Apex Code or the Data Loader
Executing Apex Code Method
A simple Apex code snipped can help us in unchecking “Set default event reminders to” Checkbox for multiple users. We will be using the Developer Console’s Execute Anonymous Window to run the Apex code.
To “Set default event reminders to” Checkbox to Unchecked, our Apex code will perform the following steps:
- Step 1: Create a List to hold Users that need an update to their settings.
- Step 2: Find all Active Users whose ‘Activity Reminder Checkbox’ is ‘Checked’ and add them to the above list.
- Step 3: Iterate through each user in the above list and Uncheck the Activity Reminder Checkbox
- Step 4: Create a final list to update to reduce the DML statements
Here’s the complete code to uncheck the “Set Default Reminders to” or any other user setting in Salesforce.
//Create a final list of Users to perform DML List <User> userList2Update = New List <User>(); // Create a list of Users whose setting needs to be changed List <User> userList = New List <User>(); //SOQL to add all users to the above list userList = [ SELECT Id, UserPreferencesEventRemindersCheckboxDefault FROM User WHERE UserPreferencesEventRemindersCheckboxDefault = True AND ISACTIVE = True]; // Iterate through each user and update the setting For (User u:userList) { u.UserPreferencesEventRemindersCheckboxDefault = False; userList2update.add(u); //Add user to the final list to update } update userList2Update; //Update the final List
Now that we have the Apex Code, lets head to the Developer Console and execute this code from the Anonymous Window (Ctrl + E)
For the Data Loader method, please visit the Salesforce Help Article
https://help.salesforce.com/articleView?id=000004609&language=en_US&type=1
For a complete list of fields on the User Object, please visit the Developer Guide
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_user.htm
Leave a Reply