The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Inbound email action not working to attach attachments to sc_task table?

Rahuldoon
Tera Contributor

Hi,

I am trying to attach the attachments through inbound action when a email is being sent as reply containing attachment. This reply mail is response for the mail servicenow initially sent.

I checked the mail logs and it is showing "inbound action did not create or update sc_task using current."

Here is the script:

var emailSysId = email.sys_id;
var qq="email="+emailSysId;
var gr = new GlideRecord('sys_email_attachment');
gr.addEncodedQuery(qq);
// gr.orderByDesc('sys_created_on');
gr.query();

while(gr.next())
{
var attachment = new GlideRecord('sys_attachment');
attachment.get(gr.attachment);

 

attachment.table_name = email.target_table;
attachment.table_sys_id = email.instance;
attachment.update();
}

 

Here is the config:

find_real_file.png

1 REPLY 1

Weird
Mega Sage

It should get automatically attached if your reply is updating an existing record.

If not then one reason could be that you're trying to attach an attachment which is not allowed in the property "glide.attachment.extensions".

Servicenow documentation states "If an inbound email contains one or more email attachments, the inbound email action adds the attachments to the first record the action produces."