Body Email and Update Password error

tomaslindev
Mega Guru

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.

 

Ody.pngOdy dos.png

1 ACCEPTED SOLUTION

Viraj Hudlikar
Tera Sage

Hello @tomaslindev 

Flow Variable should be setup first in flow which is at top right corner.

VirajHudlikar_0-1736425599420.png

 

Then in your for each loop set that variable you created as per below image

VirajHudlikar_1-1736425685559.png

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

VirajHudlikar_2-1736425754662.png

 

When you sending email use that random password stored in flow variable as show in snip

VirajHudlikar_3-1736425831724.png

 

Once you run that flow temp password is set to user account and email is triggered to user.
Email snip

VirajHudlikar_4-1736425930938.png

 


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.

 

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@tomaslindev 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Viraj Hudlikar
Tera Sage

Hello @tomaslindev 

Flow Variable should be setup first in flow which is at top right corner.

VirajHudlikar_0-1736425599420.png

 

Then in your for each loop set that variable you created as per below image

VirajHudlikar_1-1736425685559.png

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

VirajHudlikar_2-1736425754662.png

 

When you sending email use that random password stored in flow variable as show in snip

VirajHudlikar_3-1736425831724.png

 

Once you run that flow temp password is set to user account and email is triggered to user.
Email snip

VirajHudlikar_4-1736425930938.png

 


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.

 

Works perfectly, thank you very much