Extracting content from attachments like doc and pdf, png

Akash_16
Tera Contributor

Hi All ,

There will be attachments on the incidents like doc, pdf, png . We need to extract the data from attachments is there any way to do.

1 REPLY 1

ankitbanerj
Tera Expert

Hi @Akash_16 please check this

 var incidentSysId = "<sys_id>"; // Example incident sys_id

    // Find the first attachment
    var attGR = new GlideRecord("sys_attachment");
    attGR.addQuery("table_sys_id", incidentSysId);
    attGR.addQuery("table_name", "incident");
    attGR.query();

    if (attGR.next()) {
        var fileName = attGR.file_name.toString();

        gs.info("Found attachment: " + fileName + " (" + fileBytes.length + " bytes)");
}

you found this response helpful, please mark it as the accepted solution and give it a ‘Helpful’ rating. Your feedback supports better answers and benefits the entire community.