How to make a field a string field after it has been set to Password (2 Way Encrypted)?

Jono Slade
Tera Expert

I have been testing encryption options and set a string field to Password (2 Way Encrypted) but can't figure out how to convert it back to a string field. All field type options are unavailable once the field has been set to Password (2 Way Encrypted).

7 REPLIES 7

Aman Kumar S
Kilo Patron

Hey,

please use below code:

var encrypter = new GlideEncrypter();  
var encrypted = your_encrypted_password // current.<<your field name>> 
var decrypted = encrypter.decrypt(encrypted);
gs.addInfoMessage("encrypted..   " + encrypted);  
gs.addInfoMessage("decrypted..   " + decrypted);
Best Regards
Aman Kumar

Thank Aman, would I create a business rule to trigger this code on load or what would you suggest?

Community Alums
Not applicable

HI @Jono Slade ,

Here is a similar discussion which has been marked correct, this could help you:

https://community.servicenow.com/community?id=community_question&sys_id=3df1aa3cdbe68c506064eeb5ca96...

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

I would suggest not to change the field type as system is not allowing you to do so.

Instead create fresh field and use it as Password 2

Regards
Ankur

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