Print this page

Apex/class method System.movePassword(targetUserId,sourceUserId)

Knowledge Article Number 000247142
Description Customers can request to have access to the following Apex method released in Winter 17:
System.movePassword(targetUserId,sourceUserId)

Release Notes:
https://releasenotes.docs.salesforce.com/en-us/winter17/release-notes/rn_apex_new_classes_methods.htm
Resolution Detailed explanation:
  • When you use movePassword, there is a source user and a target user.
  • Before calling movePassword, source user has PasswordA and target user has PasswordB.
  • After calling movePassword, source user has no password (cannot log in using any password), and target user has PasswordA.
  • The data for PasswordB is lost forever, and cannot be recovered.
The source user can have a password reset done (by an admin or with the forgot password flow), which will generate a new password (PasswordC) for the source user, that the source user can then use to log in.

The movePassword method nulls out the source user's password so that user can no longer log in without a password reset, movePassword when called on the target user more than once will have no effect, and movePassword clobbers the target user's password with no way to recover it as mentioned above.

This doesn't affect things like password history or obey any other settings in the org like updated password policies and such.

Example Use case: 
Users from one license to another(like moving Customer Community licensed user to Customer Community Plus license). To do this, it was required that the new user should have same password as that of the old user.
The old user would get deactivated later after new user is created and ready to use.  Also, both target user and source user must be Active to use this method.

How to get access to this class/method:
This method is available in Winter 17 and customers should open a case with Support to get it enabled and provide his written approval with consent and understanding of the consequences mentioned above.

 




promote demote