We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to decrypt password 2 type fields ?

Ashwini Jadhao
Giga Guru

Hi,

I have created 3 fields on form which has type as Password 2. 

fields are: 1. Password   2. secret key   3. Auth Key

In Ui action I am validating the credentials of user.So for this I have decrypted the field Password as follow:

var decryptedPassword = g_form.getValue('password').getDecryptedValue();
var data = {
username: trimStr(g_form.getValue('username')),
password: decryptedPassword

};

 

but the main issue with it is if I am validating the different user next time then authentication get failed.

and how to use all Password 2 type fields inside 

var data = {
username: trimStr(g_form.getValue('username')),
password: decryptedPassword

};

 

please help in this I am getting confused in scripting with decryption.

9 REPLIES 9

@snowDEV 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

 

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

@snowDEV 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

 

 

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

@snowDEV 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

 

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

Hi Ash,

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark my response as correct & helpful so that this thread can be closed and others can be benefited by this.

If not, please let us know if you need some more assistance.

Regards
Ankur

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

Patrick Schulte
Kilo Guru

Hi @snowDEV,

a colleague of mine @David Stutter has written an article about decrypting and encrypting "Password 2" field types.
GlideEncrypter is the class that comes in handy for this task.

Best reagrds,
Patrick