Hi All,I need to generate and set a random password for the selected user.Can anyone help me on this?Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-06-2016 03:10 AM
Hi All,I need to generate and set a random password for the selected user.Can anyone help me on this?Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2020 05:39 AM
Please try below code and see if it works for you.
After BR
sys_user
var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
var string_length = 8;
var randomstring = '';
for (var i = 0; i < string_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
randomstring += chars.substring(rnum, rnum + 1);
//gs.eventQueue()
}
gs.eventQueue("user.password", current, randomstring, current.email);
current.user_password.setDisplayValue(randomstring);
current.password_needs_reset = true;
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 07:54 AM
Hi,
There's a built in class and method for this on server side;
Example:
GlideSecureRandomUtil.getSecureRandomString(8)