Pages

Tuesday, November 26, 2013

Salesforce: Freeze API

Six months back, I wrote this blog to disable user login to SFDC temporary, maybe for major internal release.

In Winter '14 release, Salesforce introduce Freeze user feature. Administrator can easily freeze user, so he/she will not able to login to Salesforce temporary. But, if you have 500 users to freeze, it is not a nice job to open each user and click Freeze button.

Luckily, Salesforce provide API for this. It is a field called IsFrozen, located in a new object, called UserLogin. You only can see this object using API version 29.0 and above, so if you use Data Loader, make sure it is version 29.0 and above. You can query and update this object, but not create and delete as it will sync to User object.

Screenshot from Data Loader














SOQL to this object using Developer Workbench
SELECT Id, IsFrozen, IsPasswordLocked, LastModifiedById, LastModifiedDate, UserId FROM UserLogin















2 comments:

  1. I recently wanted to do this -- but only for active users, and I wanted to be sure to exclude any System Administrators. This is the SOQL I used to meet this requirement:

    Select id, userid, isfrozen from UserLogin where userid in (Select id from user where isActive=true and Profile.name!='System Administrator')

    ReplyDelete