- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 05:18 AM
i have password 2 type field in a table and i want to match it with a field on catalog item. how to do it ?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 05:23 AM
Hi,
I suggest that you create a onChange client script on your catalog item and on input of your field, call a SI.
In SI, check out GlideEncrypter.decrypt of your password2 field and get your code decrypted and compare that with your field value of catalog item. If matches, return true, otherwise false.
Mark the comment as a correct answer and helpful if it helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 05:23 AM
Hi,
I suggest that you create a onChange client script on your catalog item and on input of your field, call a SI.
In SI, check out GlideEncrypter.decrypt of your password2 field and get your code decrypted and compare that with your field value of catalog item. If matches, return true, otherwise false.
Mark the comment as a correct answer and helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 05:24 AM
Hi,
use this code in server side; possibly in business rule;
If not in business rule then query the table and use the GlideRecord object
var Encrypter = new GlideEncrypter();
var encrypted = current.<fieldName>; // current.<<your field name>>
var decrypted = Encrypter.decrypt(encrypted);
gs.info("decrypted.. " + decrypted);
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2020 05:25 AM
Hi,
You can try as below code
var encr = new GlideEncrypter();
// give the password field name
var passwordField = "Field Name";
// Encrpyting the password field.
var encrpytedpassword= encr.encrypt(passwordField);
// Now decrpyt the password
var decrpassword = encrpytedpassword.decrypt(encrpytedpassword);
gs.print("Decrypted string = " + decrpassword );
Hope this is Helpful