We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Extracting content from attachments like doc and pdf, png

Not applicable

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 @Community Alums 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.