The CreatorCon Call for Content is officially open! Get started here.

How to share the User Id and password to the requested user mail using flow designer.

shareef_223
Tera Contributor

Hello All,

I have a requirement that, i want to provide a credentials to the new user(user ID and Password) automatically. For this I created a flow. In the flow only i am going to creating the user. Once the user is created then the user will receive an email. In the email we need to include the User ID and password. 

Here the password is not getting in the email body. Can anyone help me out this. how can i share the password to the user upon the new user created in the user table. 

Thanks,

Shareef

2 REPLIES 2

Amit Verma
Kilo Patron
Kilo Patron

Hi @shareef_223 

 

What is the error being thrown when you try to send password ? 

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

sumanta pal
Kilo Guru

For security reasons, ServiceNow does not allow the retrieval of user passwords. Once a password is set, it is encrypted and cannot be decrypted. This is a security measure to protect user data. However, you can set up a process where a temporary password is generated and sent to the user, and then the user is required to change their password upon first login. Here are the steps: 1. Create a new user record with a temporary password. 2. Send an email notification to the user with their username and temporary password. 3. In the email notification, include a link to the ServiceNow portal where they can log in. 4. Enforce a policy where the user is required to change their password upon first login. Here is a sample script for creating a new user and setting a temporary password: javascript var user = new GlideRecord('sys_user'); user.initialize(); user.user_name = 'newuser'; user.first_name = 'New'; user.last_name = 'User'; user.email = 'newuser@example.com'; user.password = 'tempPassword123'; user.insert(); And here is a sample script for sending an email notification: javascript var mail = new GlideRecord('sys_email'); mail.initialize(); mail.type = 'send-ready'; mail.recipients = user.email; mail.subject = 'Welcome to ServiceNow'; mail.body = 'Your username is ' + user.user_name + ' and your temporary password is tempPassword123. Please change your password upon first login.'; mail.insert(); Remember, this is just a sample and you should modify it according to your requirements and ServiceNow best practices.