Inbound email

User_267
Tera Contributor

how can we add a attachment in inbound email action. 

2 REPLIES 2

Marcos Kassak
Kilo Sage
Kilo Sage

Hi @User_267,

 

Please refer to this post:

 

https://www.servicenow.com/community/now-platform-articles/adding-physical-attachment-to-notificatio...

 

If you found my solution correct or helpful in any way, please don't forget to mark it to help future readers! 👍

 

--

 

Kind regards,


Marcos Kassak
Solution Consultant  🎯

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @User_267 ,

Please find the below code in the inbound email action.

 

var sysAttach = new GlideSysAttachment();   


var emailSysId = sys_email.getUniqueValue(); 


gs.log("Email sys_id is: " + emailSysId, "TITUS");



if (emailSysId) { 


   var sysEmailAttachments = sysAttach.getAttachments("sys_email", emailSysId); 


   gs.log("Number of attachments found: " + sysEmailAttachments.getRowCount(), "TITUS");


   gs.log("Updating attachments to table: " + current.getTableName() + " and sys_id: " + current.getUniqueValue(), "TITUS");



   while (sysEmailAttachments.next()) { 


         sysEmailAttachments.setValue("table_name", current.getTableName()); 


         sysEmailAttachments.setValue("table_sys_id", current.getUniqueValue()); 


         sysEmailAttachments.update(); 


   } 


} 

 

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.