How do you tell if an Attachment is encrypted

Victor43
Tera Contributor

Hi,

Does anyone know how to query the sys_attachment table to tell if an attachment is encrypted or not?  Is there another table that needs to be looked at?

Thanks,

Victor

6 REPLIES 6

This is unhelpful.

Jitendra Diwak1
Kilo Sage

Hi @Victor43,

 

To check if an attachment is encrypted in ServiceNow via script, you can use GlideSysAttachment API. Here's a sample script:

 

```javascript

var attachmentSysId = 'attachment_sys_id_here'; // Replace 'attachment_sys_id_here' with the sys_id of the attachment you want to check

 

var attachmentGR = new GlideRecord('sys_attachment');

if (attachmentGR.get(attachmentSysId)) {

    if (attachmentGR.isEncrypted()) {

        gs.info('Attachment is encrypted.');

    } else {

        gs.info('Attachment is not encrypted.');

    }

} else {

    gs.info('Attachment not found.');

}

```

 

This script checks if the attachment with the specified sys_id is encrypted or not. If it is encrypted, it logs a message saying so; otherwise, it logs that the attachment is not encrypted.

 

Please accept my solution if it resolves your issue and thumps 👍 up 

 

Thanks 

Jitendra 

NO, THIS IS NOT HELPFUL!

YOU JUST ASKED A GPT, WHICH HALLUCINATED, AND YOU NEVER CHECKED YOUR ANSWER.

IT'S SAD THAT THERE'S NO "UNHELPFUL"  BUTTON HERE.