Encrypting attachment while inserting or updating a record

Community Alums
Not applicable

Hi All,

I have configured encryption context and running the script https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/script/server-scripting/concept/...

as per the doc. But this script works only when running from scripts background.

Not working in Scheduled Job (even i put as run as encryption context role) , Business rule, Script etc..

Could anyone help on this?

13 REPLIES 13

find_real_file.png

The script on that business rule.

Besides all the BR that came with the encryption support app, this looks like it was the only custom BR that I made.

 

var contextGR = new GlideRecord('sys_encryption_context');
contextGR.addQuery('name', 'Wire Fraud Encryption');
contextGR.query();
if (!contextGR.next()) {
gs.log("[ERROR] No encryption context found");
}
var encryptionID = contextGR.getUniqueValue();
gs.info("i am BR encryptionID-->"+encryptionID);
if (encryptionID != "") {
var sysAttachment = new GlideSysAttachment();
sysAttachment.changeEncryptionContext(current.table_name, current.table_sys_id, current.sys_id,encryptionID );
}

Thanks for all the help @Jeff316 ðŸ™‚

 Hello Jeff,

 

I've looked through your BR and implemented on my personal instance. I tried creating an inbound email with attachments. However, the attachments were still not encrypted even BR was set on "after". The script worked when running from background.

 

Can you suggest anything?

 

Thanks.