Admins can utilize Salesforce Flow to create and streamline business processes in the Salesforce platform. Flow offers endless use cases, which enables organizations to automate and optimize their operations. Additionally, Salesforce Flow allows the creation of administrative workflows, enabling both admin and non-admin users to proficiently execute these tasks. As an example, you can set password for multiple users using a custom invocable action.
In this post, you can find an invocable action that lets you set password for multiple users. Pay attention that this is not same as resetting password. You can set any password that you want and give it to the users.
How to Use the Component
1- Install the component using the installation links below.
2- Add a new action to your flow and search for Set Password, this is the name of the action that you installed.
3- This action can set password for multiple users. Therefore, you should pass the user ids (as a text collection) to userIds input value. Secondly, provide a password value for the selected users. This will be the new password of those users.
Example
1- Add a screen with a lookup input component. This lookup component should allow selecting multiple user records. Then add another field for the new password. It can be a text or a password field. Optionally, add another one for password confirmation.
Using 'Validate Input' option, you can make sure that the values are equal.
2- Add the Set Password action and provide values for user ids and password. Lookup component stores the selected records as a text collection. So, you can just enter the output of the lookup component. You can use another selection component like picklist with a record choice set too. In this case, you need to create a text collection and use an assignment to add ids to the collection.
At the end, your flow should look like this. This is just a simple flow to show how the action works. Don't forget to add fault paths to your flow!
Considerations
- This action works for external (community) users as well.
- Non-admin users can use the flow as well.
- Unlike reset password, users don't get an email about their new password.
- Make sure to follow the password policies (minimum password length and complexity requirement).
- Although it is a very useful action, it can be very dangerous. You don't want users to set password for other users. Therefore, you should build your flow carefully and give access to specific users only. You can use custom permissions or restrict access to enabled profiles or permission sets.
Installation Links
Use this link to install in production or developer edition environments.
Use this link to install in sandbox environments.
This package contains one more action to Reset Password for selected users. Click here to read about this action.
I'm looking into customization of user self service and want to use the component in a flow where a default password is automatically assigned (temporary) for newly created users.
I encounter difficulty in finding the just created UserId in the flow, only the UserId which is available under Global Variables. Creating a subflow where the UserId is set as new variable doesn't work either.
Can, and if yes, how do you select the newly created user record to change the password in?
Hi Bart, when you create a record in flow, it automatically stores the Id of the record. So in this case, it will store the Id of the user.
For example, if the name of your create records element is Create_User then the Id of the new user will be stored in {!Create_User}.
You can search for "UserId from Create_User".
Hi Yumi, thanks for your quick response. I am able to create a variable for the UserId, but it is not possible to use it in the component. It only allows an ID from the User object, which is obviously the running user.
My purpose is to use the newly created record ID to set a password for and send a custom email message with that temp (default password) to the new user.
Are you sure this is working fine? You cannot retrive the user ID as Bart mentioned in his previous comment. Check this: https://i.imgur.com/5w8WUvS.png
UserIds is a text collection. You have to use an assignment element and add the user id to a text collection.
This does not work, when I try to debug it keeps giving an error in the Lookup User field saying I do not have access to the object.
Are you getting the error from the lookup field or from this action? If the error is on the lookup field, it means that you don't have enough permissions for that field/object. Can you try to build the lookup using Account.OwnerId? You can also use User.ManagerId field for this.
Also, are you running the flow in system context?
Hi, Thank you for your response, I am a system Admin and have full access to the User object. The flow is being run in System Context - Access All Data. The second error I also got is: Select_User (Screen) - This screen includes screen components that require Lightning runtime.
Hi, Thank you for your response, I am a system Admin and have full access to the User object. The flow is being run in System Context - Access All Data. The second error I also got is: Select_User (Screen) - This screen includes screen components that require Lightning runtime.