6

As you know, there is freeze user feature came up in latest release. We can freeze the user if we are not ready to deactivate it .

how can i freeze a User with code ? Can we report on the Freeze users ?

I could not find any field on user which shows whether a user is frozen or not .

8
  • 1
    What would be the use case for this functionality? Presumably, you're freezing a user because you intend to permanently deactivate them. – sfdcfox Sep 27 '13 at 13:33
  • A user can be linked to other multiple records. To deactivate it we have to remove all the links whereas if a freezed user can be linked to other records. the functionality gives time to Admin to do all the impact analysis before deactivating the user. – amidstCloud Sep 28 '13 at 15:28
  • I know what freezing is. I meant, what would be the point of freezing a user through code instead of manually? – sfdcfox Sep 28 '13 at 16:38
  • Yeah. I do know not the explanation here.But, this is the requirement. Could u pls me with How to make a report on the freeze user. Admin wants a report on who all are freeze user. – amidstCloud Sep 29 '13 at 10:36
  • 1
    As far as I can tell, what you're asking for is impossible. No documentation states that you can report or query frozen users, or toggle this flag through any API or Apex Code. The point of asking "why" is so that salesforce.com might run across this question, and want to know what business use case it might possibly have. Without any reason why, other than "because we want to", salesforce.com is likely not to deliver such a feature until they feel they have time, which might be never. You should find out why they want this. – sfdcfox Sep 29 '13 at 16:35
7

the UserLogin SObject has an IsFrozen field, you can set this to true (from apex, api etc) to freeze a user. You can query this field from SOQL to determine who is frozen (and also who has a password lockout in effect), I haven't looked but i'd think you can do a regular report against this object as well.

5

I wasn't able to find a way to do this from regular Apex, but it is possible using the SOAP API. I've blogged a Visualforce solution that uses the Ajax toolkit to retrieve the frozen status of the users and provide buttons to freeze/unfreeze each user:

http://bobbuzz.me.uk/185q7Yg

4

Here is some sample code that I used to this:

List<UserLogin> users = [SELECT IsFrozen,UserId FROM UserLogin WHERE UserId IN 
    (SELECT Id FROM User WHERE Profile.Name != 'System Administrator' 
    AND UserType = 'Standard' AND IsActive=True) 
    AND UserId != :UserInfo.getUserId()];
for (UserLogin ul : users) { ul.isFrozen = True; }
update(users);
0

This is possible in two ways: 1) Using Dataloader 2) Scripts to execute in Developer console http://theblogreaders.com/users-freeze-unfreeze-salesforce-using-script/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.