Lifecycle Event, Onboarding: how to set an initial password via a flow triggered by the le_case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 07:05 AM
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.
- Labels:
-
Employee Service Center

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 07:32 AM
@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.