- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 02:53 AM
Hello everyone,
I have created a flow to force certain users to enter a new password and generate a temporary one to send to their email. The problem is that I cannot embed the generated password in the body of the email (for which I have used a variable flow). Any ideas?
Thank you very much in advance and best regards.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 04:32 AM
Hello @tomaslindev
Flow Variable should be setup first in flow which is at top right corner.
Then in your for each loop set that variable you created as per below image
Script will be like
var randomNUmber = Math.floor(Math.random() * 1000);
var tempPass = fd_data._2__for_each.item.first_name.toString()+ fd_data._2__for_each.item.last_name.toString() + randomNUmber;
return tempPass.toString();
Next step save that random generated password to user profile as below
When you sending email use that random password stored in flow variable as show in snip
Once you run that flow temp password is set to user account and email is triggered to user.
Email snip
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 04:24 AM
you need to create a flow variable
Then set that flow variable with the random password (currently what you are doing in script for password field of Update Password action)
Then use that flow variable
where is the step to set flow variable?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 04:32 AM
Hello @tomaslindev
Flow Variable should be setup first in flow which is at top right corner.
Then in your for each loop set that variable you created as per below image
Script will be like
var randomNUmber = Math.floor(Math.random() * 1000);
var tempPass = fd_data._2__for_each.item.first_name.toString()+ fd_data._2__for_each.item.last_name.toString() + randomNUmber;
return tempPass.toString();
Next step save that random generated password to user profile as below
When you sending email use that random password stored in flow variable as show in snip
Once you run that flow temp password is set to user account and email is triggered to user.
Email snip
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 05:29 AM
Works perfectly, thank you very much