The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Setting encrypted password for user from service catalog and using flow designer.

Raksha Kapse
Tera Contributor

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 

1.png2.png3.png4.png5.png

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Raksha Kapse 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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.