Bite #16: Password vs Password2

There’s two types of password fields in ServiceNow — this goes both for creating a new field, and creating a new system property. Here’s the skinny on how they’re different and how to use them…

Password

  • Use this when you don’t need to use the password anywhere in your code. You never need to decrypt it.
  • This is used primarily for the sys_user.password field. The system asks you for a password, encrypts it via the same method, and then checks if it matches.

Password2

  • Use this when you DO need to use the password in your code.
  • Example:
    • I’ve got a password “asdf” stored in a system “Password2” system property.
    • In my code, I can now do the following to get the plain text password back:
      var encryptedPass = gs.getProperty("config_pass");
      var pass = new GlideEncrypter().decrypt(encryptedPass);


Categories: Developers, Scripting Tips, Tips and Tricks, Uncategorized

Tags: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: