Inbound email action not working to attach attachments to sc_task table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 07:53 AM
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:
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 04:32 AM
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."