Tag Archives: Freeze

Freeze and UnFreeze Users in Salesforce Using Apex

Sample Code:

//Freeze User
UserLogin ulogin = [SELECT Id, IsFrozen, UserId From UserLogin Where UserId = '00558000003n7iGAAQ'];
ulogin.IsFrozen = true;
Update ulogin;

//UnFreeze User
UserLogin ulogin = [SELECT Id, IsFrozen, UserId From UserLogin Where UserId = '00558000003n7iGAAQ'];
ulogin.IsFrozen = false;
Update ulogin;