How to convert a password data type to Plain Text or String Data type through scripting?

Tejas16
Tera Contributor

Scenario: As soon as new user record [sys_user] is created then send notification to newly created user with his UserID and password?

I tried by using:

step1) Create a event registry

step2) Calling event in after insert Business rule 

step 3) Create a Notification

After previewing the notification it shows the same password as I have put in password field while creating new user. 

ISSUE: But when actual notification is sent then it contain password is 24 character encrypted key.

I tried using toString() Method but it won't works.

So How Can we convert password datatype to String data type? 

 

 

2 REPLIES 2

Abhijit4
Mega Sage

Quite interesting issue. If you are able to see password in ServiceNow emails then it should also be visible same in outlook. However, could you please try assigning that password to another variable and then include variable in notification.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

MrMuhammad
Giga Sage

Hi,

You can GlideEncrypter() APi to decrypt password before sending it over to notification email.

Please read this nice article for details: https://davidmac.pro/posts/2020-12-24-sn-encrypt-decrypt/

Please note, you might need to do decryption twice/thrice if password is 24 encrypted characters.

Mark helpful/correct, if applicable.

Regards,

Muhammad 

Regards,
Muhammad