Lifecycle Event, Onboarding: how to set an initial password via a flow triggered by the le_case

Viktor16
Tera Contributor

Hi there, 

 

I am trying to investigate how to get a New Joiner their initial login to the portal.

 

Considering building a flow that is triggered by the creation of the HR Case (Lifecycle Event) and does the following:
1) generate a random password using 

// Set a secure initial password
var initial_password = GlideSecureRandomUtil.getSecureRandomString(8) + "!";
return initial_password;

2) Update the User [sys_user] record

active=true;
locked_out=false;
password_needs_reset=true;
user_password= initial_password;

3) then generate an event-triggered notification that contains the information

- Username

- Password

- URL

 

But when I reset the password via the update record I cannot log in with the user. via /login.do, but I can see the record is updated, but the password seems to be incorrect? Does anyone know why? someone told me it might be related to the 1way encryption but can't seem to understand the issue. 

 

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@Viktor16 Try setting the display value of the password field, for more information please refer to thread https://www.servicenow.com/community/developer-forum/how-to-set-a-password-through-script-for-users/...

 

Hope this helps.