function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rashed Yaqubi 10Rashed Yaqubi 10 

Reset User Password with Flow and Apex Action/Class

Hi there, I am trying to setup a screen flow that asks for a User's name, after which I want to call an apex action that resets that user's password. I am a little unclear on how the Apex class would look - ideally I want to call it within the flow, pass the user Id to it and hasve it reset the password and send the password reset email.

Your help is greatly appreciated!
VinayVinay (Salesforce Developers) 
Hi Rashed,

Check below details.

For apex you can try below snippet.
List<User> u = new List<User>();
List<Id> ids = new List<Id>();
String test = 'test';
u = Database.Query('SELECT Id, Name FROM User WHERE Name =: test');
System.debug('User details are ' + u);
for(User usr : u)

For flow.

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

PriyaPriya (Salesforce Developers) 

Hi Rashed,

To use an Apex class/or make the apex method visible to flow that particular method should be having @InvocableMethod.

Kindly refer this link :-

Please mark it as best answer if you find the above information helpful.


Priya Ranjan