This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script #1 | |
// Script to run FIRST before Freezing the users | |
// get sys-admin profiles for exclusion - ENTER ANY CUSTOM PROFILES FOR SYSTEM ADMINISTRATORS | |
list<Profile> admins = [SELECT id FROM Profile WHERE Name IN ('System Administrator', 'Premier Support User')]; | |
// get profiles to be included | |
list<Profile> pro = [SELECT id, Name FROM Profile WHERE id Not IN :admins ORDER BY Name]; | |
// add to set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script #2 (modify and repeat) | |
// script for FREEZING/UNFREEZING users in order to perform administrative tasks | |
// CONTINUE to run this script over and over depending on how many users are in the org (see batch size below) | |
// Review the DML rows portion of the debug log, run until that says 0 | |
// TODO ---------------------------------------------------------------------------------------------------------------------------- | |
// size of query for userslogin records and DML | |
Integer batchSize = 2000; | |
//TIP: Set batchSize to 0 and run this to review the debugs, verifying profile name etc. |