Setting encrypted password for user from service catalog and using flow designer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 03:03 AM
Hii community,
I stuck on one requirement where I have to create user record with a field value using flow designer and field values are:
First name ,last name ,user id , password
I successfully created the user with first name, last name and user id but password is not set. For that I created one custom action to encrypt masked variable and where I have written the following code:
(function execute(inputs, outputs) {
// ... code ...
var pwd = inputs.passwd; var encr = new GlideEncrypter();
outputs.password2 = encr.encrypt(pwd);
outputs.plainText = pwd;
})(inputs, outputs);
After this I can see the encrypted password in show xml file in the user_password field but when I try to login with the same user id and password it gives me an error like user name or password is not correct.
Please give me a suggestion for this.
@Ankur Bawiskar @Pradeep Sharma @Chuck Tomasi @Asif @Jaspal Singh @Allen Andreas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 03:13 AM
while setting user password you need to set the display value
I could see you are using catalog item and possibly masked type of variable then you can use this script directly while setting that field and no custom action etc is required
use the inline f(x) script and use this while setting the password field on user record
return fd_data.trigger.request_item.variables.variableName.getDecryptedValue();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 03:23 AM - edited 10-17-2022 03:29 AM
Thanks @Ankur Bawiskar
I got the decrypted value in user_password field.
Like I set password as 'Pass@123' and I got 'Pass@123' in show xml file but still I am not able to logged in with the same user name and passsword.