Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Retrieve Password2 Field real value

Gpope
Tera Contributor

Hi Community! 

 

Anybody can help me with this issue I'm facing? 

 

I have a password2 field on core_company table. I need to get the real value that is on the field, how can I achieve this? 

 

I tried already with glideEncrypter but it's showing me only values like: 

 

Gpope_0-1713982380439.png

 

Thanks! 

9 REPLIES 9

Community Alums
Not applicable

You cant do that, sorry. Thats the idea in general of the field type password2. If its 1 way encrypted GlideEncripter will do, but here no way. If you need the passwords either change the field (drop & recreate it) or use before script to save it to new custom field of type 1 way encripted.

James Chun
Kilo Patron

Hi @Gpope,

 

Do you mind sharing the script?

If it's a password2 type, it can be decrypted but I do remember that the GlideEncrypter function has/will be deprecated.

https://docs.servicenow.com/bundle/washingtondc-platform-security/page/administer/key-management-fra...

 

Cheers

Community Alums
Not applicable

Right, 2 way should be reverable. I am pretty sure the script is this one and needs base64 decode maybe:

var Encrypter = new GlideEncrypter();

var encrypted = current.u_password; // current.<<your field name>>

var decrypted = Encrypter.decrypt(encrypted);

gs.addInfoMessage("encrypted.. " + encrypted);

gs.addInfoMessage("decrypted.. " + decrypted);

Gpope
Tera Contributor

Gpope_0-1714074872435.png

Hi @James Chun ,  code im using now is similar to what Joro said before.