How to copy attachments from inbound action to incident record.

KARAN24
Tera Contributor

Hi Team,

 

When emails are sent to servicenow with attachments ,the attachments are not getting added to respective incident record.And also we need to validate if the email sent is from user present in servicenow.If the user is not present we do not have to copy the attachments.

 

How we can achieve this.

 

Thanks in Advance.

 

Regards,

Karan

7 REPLIES 7

Samaksh Wani
Giga Sage
Giga Sage

Hello @KARAN24 

 

GlideSysAttachment.copy('sys_email',current.sys_id,'sc_req_item',ritm.sys_id);

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

 

 

Hi Samaksh,

 

Can you please help me with the inbound action,as I would like to create a new inbound for attachments.

 

Thanks,

Karan

Hello @KARAN24 

 

 

var sysAttach = new GlideSysAttachment();   


var emailSysId = sys_email.getUniqueValue(); 



if (emailSysId) { 


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

   while (sysEmailAttachments.next()) { 

         sysEmailAttachments.setValue("table_name", current.getTableName()); 
         sysEmailAttachments.setValue("table_sys_id", current.getUniqueValue()); 
         sysEmailAttachments.update(); 

   } 

} 

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

Hi Samaksh,

 

I have created an inbound on case table,but it is not working.Can you please check .

KARAN24_0-1689670233199.png

Thanks,

Karan