How to get all attachments from email received using inbound action

Evren Yamin
Tera Contributor

If the instance received an email with attachments.

How could I include the attachments in the created task using inbound action?

Appreciate all the help.

Thank you.

1 ACCEPTED SOLUTION

Hi @Evren Yamin ,

I think what is happening is your attachments are getting picked up by some other pre-defined OOTB inbound action, most probably "Create Incident". Can you go to the Inbound Actions list from the application navigator, and deactivate the Create Incident action, and then try?

Also, like i've mentioned above, you don't have to query the attachments explicitly and then associate it to the task, if you're doing current.insert/current.update already in your inbound action to create/update a task.

 

Thanks & Regards,

Rishabh Jha

Aavenir(http://www.aavenir.com/)

View solution in original post

9 REPLIES 9

Chander Bhusha1
Tera Guru

Hi Evren,

You can follow the Steps mention in the link as it will guide you to copy the attachment to target table coming from inbound email action.

Copy Attachment from Email

 

Please mark answer correct and helpful.

Thanks,

CB

Ankush Jangle1
Kilo Guru

hello

try this code it will help you

var attachmentName = '';
var test = sys_email.sys_id;
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_name','sys_email');
gr.addQuery('table_sys_id',test);
gr.query();

if(gr.next()){
attachmentName = gr.file_name;
}

 

Please Mark it as correct/Helpful if it helps you

Rishabh Jha
Mega Guru

Hi @Evren Yamin ,

 

You don't have to explicitly query the attachment table and add the attachment to your task record. Servicenow implicitly does that for you.

You'd just need to call current.update() in your inbound action once, and it should associate all the attachments from the inbound email to the glide record in the transaction context.

 

Thanks & Regards,

Rishabh Jha

Aavenir(http://www.aavenir.com/)

Evren Yamin
Tera Contributor

Hi everyone,

Is it possible to get the attachment of email receive and include it in the created task? not incident?

Thanks