GlideEncrypter is not allowed in scoped applications

prasad48
Tera Guru

GlideEncrypter is not allowed in scoped applications.How can i access the function in scoped application?

9 REPLIES 9

The SN Nerd
Giga Sage
Giga Sage

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



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

This answer is so confusing. What do you mean "Why are you developing in an application scope?". I assume this is an outdated answer but just seems odd. There are many use cases where people need to encrypt and decrypt in a scoped app. 

Inactive_Use408
Kilo Expert

It's ridiculous that you can't encrypt or decrypt anything in scoped app scripts.

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');