You need to sign in to do that
Don't have an account?
lavanya gottumukkala
How to reset password for a user through apex code
Hi All,
We have one visualforce page.In that page there is one checkbox field related to contact object.What our requirement is when we click on that check box,the 'Active' checkbox in user object should be checked and reset password for that user.Can any one help me?
Thanks in advance
We have one visualforce page.In that page there is one checkbox field related to contact object.What our requirement is when we click on that check box,the 'Active' checkbox in user object should be checked and reset password for that user.Can any one help me?
Thanks in advance
I assume that you will get userid in apex and once you have that you can call
Thanks,
Himanshu
Are you talking about Community/Portal user ? That when you click teh checkbox in contact then teh user related to contact will be active and it will send for reset password link to user ?
If yes then you need write logic in your VF page controller or extension to collect the checked contact Id and then Query from user to get the related users which are inactive .then you can follow what HImansu has posted .
Here one more thing I need to tell you that
public static System.ResetPasswordResult resetPassword(ID userId, Boolean sendUserEmail)
resetPassword method wil take id and boolean .You need to pass the Id of user and boolean if you make true then it will send email to the user inbox to reset the password .
If the contact is not related to community or portal then which user you want to do the action .
If you want to do with other approach you can check below links in appexchage there are two application to reset mass usser's password .
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000003GwqQEAS
https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B4QBQEA3
Thanks
Manoj