[SalesForce] Setting Password via APEX

I'm try to set a user password and executing the system.setPassword(UserId, Password) method and I always get an error saying that the UserId is invalid. I've checked it and it's the correct UserId. Example: System.setPassword('test@test.com','test');

Best Answer

The first parameter of that function call is the actual id of the user object. User Ids start with 005 and are 15 or 18 Characters long. for example:

System.setPassword('005300000123aBc','A$tr0ngPW');
Related Topic