add attachments to the table through email

shivaadapa
Tera Expert

Hi 

How to attach any files to the incident record through inbound email action.
In the instance there is a OOTB create incident inbound email action but there is no any attachment related code over there.

5 REPLIES 5

SanketLandge1
Kilo Guru

Hello @shivaadapa ,

 

 

var attachment = new GlideSysAttachment();
var emailSysId = sys_email.getUniqueValue();
var attachmentName = '';
var gr1 = new GlideRecord('sys_email');
gr1.addQuery('istance',current.sys_id);
gr1.query();
var grSysId = gr1.sys_id;
GlideSysAttachment.copy('sys_email',emailSysId,'incident', "pass incident sys_id");

 

 

You can use the above code to copy the attachments from your email to the target table. 

 

Please mark helpful or correct if this helps you.

Hi @SanketLandge1 

incident is creating but attachments are not attaching to the incident record.

Hello @shivaadapa 

GlideSysAttachment.copy('sys_email',emailSysId,'incident', "pass incident sys_id");

 

 

Use below code to attach the attachments on the incident record. 

Hi Shivaadapa,

 

Try using flow designer and use action copy attachment.

 

siddharth26_0-1710498542057.png

Please mark helpful or correct if this helps you.

thanks

sid