How to make a field a string field after it has been set to Password (2 Way Encrypted)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 10:41 AM
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).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 10:49 AM
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);
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2022 08:39 AM
Thank Aman, would I create a business rule to trigger this code on load or what would you suggest?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 10:20 PM
HI
Here is a similar discussion which has been marked correct, this could help you:
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 10:26 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader