- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 01:55 AM
Hi everyone,
I need your help to reset the password of several users under certain conditions, for this I have created a flow that will be executed only once and I have used the “Update password” action, using the script section of the action I have added the following script to create an encrypted password formed by the first and last name of the user plus a random number, and then add the password to the body of an email to send to each user. The flow returns this error “Error: password must not be empty (sys_script_include.c2bb80aa73126300039a2ea3c4f6a721.script; line 20)”. Any ideas?
Thank you very much and best regards.
(function execute(inputs, outputs) {
var first_name = inputs.first_name;
var last_name = inputs.last_name;
var randomNumber = Math.floor(Math.random() * 1000);
var password = first_name + last_name + randomNumber;
var encr = new GlideEncrypter();
var encryptedPassword = encr.encrypt(password);
outputs.encryptedPassword = encryptedPassword;
gs.info('First name: ' + first_name);
gs.info('Last name: ' + last_name);
gs.info('Generated password: ' + password);
gs.info('Encrypted password: ' + encryptedPassword);
})(inputs, outputs);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 07:35 AM
Hi Tomas.
I tried in a Background script , its something like this. But I am not convinced of the way in which you are proposing, as it may incur in error, but if it is as indicated I recommend that you pass in an email the password if the user to avoid sending confidential information.
*** Script: First name: John
*** Script: Last name: Doe
*** Script: Generated password: JohnDoe991
*** Script: Encrypted password: KNXvgcvr3QBKrGjyHNEceg==
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 02:09 AM
seems the OOB script include "PasswordResetUtil" is throwing error at line 20
Did you try running it from background script and verify first?
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-07-2025 02:15 AM
Line 20 of the OOB script that includes "PasswordResetUtil" which is throwing an error on line 20 is the final part of the Script that includes the inputs and outputs. I have run it all in a Background Script and I am still stuck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 03:11 AM
you need to debug further
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-07-2025 02:13 AM
check this link
Solved: Update Password Action in Flow Designer
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