logo

NJP

ServiceNow - Encrypt a field on the RITM form containing sensitive variable: GlideEncrypter/Decrypter

Import · Mar 24, 2022 · article

Before insert business rule (on RITM)

( function executeRule*(current,* previous /*null when async*/ ) {

var encr = new GlideEncrypter*();*

var encrypted = current*.variables.sensitive_data;*

var encrString = encr*.encrypt(encrypted);*

current*.u_encrypted_box *=** encrString*;*

// gs.addInfoMessage('encrypted: ' + encrString);

})(current*,* previous*);*

Decrypter UI Action (on RITM)

gs*.addInfoMessage('DECRYPTED: ' *+** new GlideEncrypter*().decrypt(current.u_encrypted_box));*

//}

action*.setRedirectURL(current);*

## Reference:

https://developer.servicenow.com/print%5Fpage.do?release=Paris&category=null&identifier=GlideEncrypterAPI&module=api

View original source

http://www.cloudminus89.com/2022/03/encrypt-field-on-ritm-form-containing.html