How to use Password Properties
There are quite a few ways to store encrypted passwords and fields in ServiceNow, besides just the obvious credential table and user table. A little known method is to use the Password Type for System Properties.
How to Create a Password System Property
This part is reasonably documented on the ServiceNow Docs, and it’s not too different from a regular system property.
In the filter navigator type “sys_properties.list” and click enter.
Select to create a new property.
Fill out the name, description, and set the type as “password”, and put the password you want to encrypt in the value field.
Submit/Save the record, and notice the value changes to an encrypted value.
How to Decrypt from a Password System Property
You could shorten this down to a single line if needed, but you can easily decrypt the value from the property value using the following script.
var passwordEnc = new gs.getProperty('property.name'); var ge = new GlideEncrypter(); var decrString = ge.decrypt(passwordEnc);
There is a limitation because GlideEncrypter is not natively available in Scoped Applications. If you need to get around this security limitation, you can easily create a global script include wrapper for GlideEncrypter, and then just call that from your scoped app.