Adding Encrypted Attachments to Email Notifications

luke_vf_08
Kilo Expert

Hi All,

I have setup a business rule on the sys_attachment table to encrypt all attachments with an encryption context. This works fine, except for when sending notifications.

The code on the business rule is:

var contextGR = new GlideRecord('sys_encryption_context');

contextGR.addQuery('name', 'ess');

contextGR.query();

if (!contextGR.next()) {

gs.log("[ERROR] No encryption context found");

}

var encryptionID = contextGR.getUniqueValue();

if (encryptionID != "") {

  var sysAttachment = new GlideSysAttachment();

  sysAttachment.changeEncryptionContext(current.table_name, current.table_sys_id, current.sys_id, encryptionID);

}

The email notification is configured to include an attachment on the table it is associated with:

find_real_file.png

And the email processed in the outbox is sent, but because the attachment is encrypted, it does not get included in the email sent. If the encryption business rule is turned off it works fine.

find_real_file.png

So, does anyone know how to make it so the email notification decrypts the attachment on send? My thought at the moment is to decrypt the attachment, send the notification then re-encrypt the attachment (within the business use cases of course). But this seems like a bit of a hack.

1 ACCEPTED SOLUTION

bradpsnc
ServiceNow Employee
ServiceNow Employee

Hi Luke,



Unfortunately this is a know PRB with the platform, the end result as you have mentioned is an email that is missing its encrypted attachment. This problem will be reviewed by our development team but it will take time before a fix is implemented.



Thanks,


Brad


View solution in original post

5 REPLIES 5

bradpsnc
ServiceNow Employee
ServiceNow Employee

Hi Luke,



Unfortunately this is a know PRB with the platform, the end result as you have mentioned is an email that is missing its encrypted attachment. This problem will be reviewed by our development team but it will take time before a fix is implemented.



Thanks,


Brad


Thanks for that info Brad. Are able to let us know the PRB number?


bradpsnc
ServiceNow Employee
ServiceNow Employee

Hi Luke,



Sure this issue is documented under PRB639238.



Regards,


Brad


Dave65
Tera Contributor

Hi Brad


It's been 5 years now and as far as I can tell, nothing has changed.
I want to have ServiceNow encrypt an attachment and then be able to send it out as an encrypted attachment and be able to supply the key so the recipient can open the attachment.

How do I voice my needs to ServiceNow?