Email Client Template Attachments

NaveenK08632274
Tera Contributor

What is the process to send an email with attachments using Email Client Templates, ensuring that the attachments are visible while composing the email?

The attachments are configured in the Email Client Template so that when the template is selected in an Incident, the attachments are automatically included and displayed in the email composition window.

11 REPLIES 11

@NaveenK08632274 

I will suggest see if any custom solution works

if not then train your agents on how the OOTB platform work and minimize the technical debt

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @NaveenK08632274,

Could you please replace the before script with this? Only attachments associated with the current record will be added.

(function executeRule(current, previous /*null when async*/ ) {

    var attachmentIds = [];
    var attachmentGr = new GlideRecord('sys_attachment');
    attachmentGr.addQuery('table_sys_id', current.getValue('target_record'));
    attachmentGr.query();

    while (attachmentGr.next()) {
        attachmentIds.push(attachmentGr.getUniqueValue());
    }

   
    attachmentIds.forEach(function(attachmentID) {
        var gr = new GlideRecord('sys_email_draft_attachment');
        gr.initialize();
        gr.email_draft = current.getUniqueValue();
        gr.content_disposition = 'attachment';
        gr.attachment = attachmentID;

        gr.insert();
        
    });



})(current, previous);

 

If you find this helpful, please consider marking it as Helpful or Accepting it as the Solution.

Thanks & Regards,

Harish