Copy attachments from Kb artical to Notification

sushma9
Tera Contributor

Hi All,

I am copying the attachments  from Kb article to notification email and i  writing the email script to do that but i its not working .Please find the attached script below and let me know if anything has to be modified.

 

script :

 var grAttach = new GlideRecord("sys_attachments");
    grAttach.addQuery("table_name", "kb_knowledge");
    grAttach.addQuery("sys_id", "56dba1121b36b998bcae5457604bcbdc")
    grAttach.query();
    if (grAttach.next()) {
        GlideSysAttachment.copy('kb_knowledge', '56dba1121b36b998bcae5457604bcbdc', 'sys_email', current.sys_id);
    }
5 REPLIES 5

Voona Rohila
Kilo Patron
Kilo Patron

HI @sushma9 

Modify the Table name of attachment to 'sys_attachment' 
Sample code:
 var grAttach = new GlideRecord("sys_attachment");
    grAttach.addQuery("table_name", "kb_knowledge");
    grAttach.addQuery("table_sys_id", "56dba1121b36b998bcae5457604bcbdc")
    grAttach.query();
    if (grAttach.next()) {
        GlideSysAttachment.copy('kb_knowledge', '56dba1121b36b998bcae5457604bcbdc', 'sys_email', current.sys_id);
    }

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

@Voona Rohila 

I am not able to copy the attachments in notifcation

 

Hi @sushma9 

Can you explain in detail of where you are using the code?


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Refer Below link which explains similar requirement

https://www.servicenow.com/community/itsm-articles/copy-attachments-to-email-client-template/ta-p/23...

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP