Inbound action attachment not copied to record

Zuri
Tera Expert

Inbound action email is received but attachment is not uploaded to the record.

2 REPLIES 2

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Zuri 

On which table the inbound email action target record present?

 

If it is custom target record, it may not work

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0953178

 

Please mark the answer as helpful and correct if helped.

Kind Regards,

Ravi Chandra 

nishantkhet
Tera Contributor

Check the script in the Script tab to ensure it is designed to handle and attach files to the target record.

var emailAttachment = email.attachments;
if (emailAttachment && emailAttachment.hasNext()) {
    while (emailAttachment.hasNext()) {
        var attachment = emailAttachment.next();
        gs.log("Attachment found: " + attachment.name);
        attachment.copyToRecord(targetTable, targetSysId);
    }
}

Also, you may try to add logs to inbound email action to monitor its behavior.

gs.log("Inbound email triggered. Checking for attachments...");
if (email.attachments && email.attachments.hasNext()) {
    gs.log("Attachments found: Processing...");
} else {
    gs.log("No attachments found in the email.");
}

I would appreciate it if you could mark it as helpful or correct. This helps others in the community who may have similar questions.