‎10-23-2016 02:58 PM
GlideEncrypter is not allowed in scoped applications.How can i access the function in scoped application?
‎10-23-2016 06:21 PM
Short answer: You can't.
Why are you developing in an application scope?
If you don't intend to put your app on the store or deploy it at your customers, you might want to reconsider your design choice.
Otherwise, you need to find an alternative API call.
Check out https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&type=server&scoped=true
‎06-26-2020 03:18 PM
It's ridiculous that you can't encrypt or decrypt anything in scoped app scripts.
‎06-26-2020 03:25 PM
You can use it in scoped apps like below
gr.password.getDecryptedValue() can be used in scope apps for scoped decrypt
gr.password.setDisplayValue('un-encrypted string goes here'); can be used for scoped encrypt
var encrypter = new GlideEncrypter();
var encrypted = encrypter.encrypt('Super Secret Phrase');
gs.info('encrypted: ' + encrypted);
var decrypted = encrypter.decrypt(encrypted);
gs.info('decrypted: ' + decrypted);
gr.password.getDecryptedValue();
gr.password.setDisplayValue('un-encrypted string goes here');
‎01-22-2021 07:37 AM
The code in the previous reply did not work for me, however, there is a ScopedEncrypter class available for scoped apps (it's a Script Include!).
In my app, I used the code below:
var encryptedSecret = "<your encrypted secret goes here>";
var decryptedSecret = new global.ScopedEncrypter().decrypt(encryptedSecret);