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

Attachment in inbound email does not get attached to the scoped app record

Binglin Huang
Tera Expert

Working on a scoped app atm. Trying to add attachment to a record by replying the notification with attachments. The inbound email is added to the correct record, but the attachments are not.

 This reply should have an attachment but it is not added to the record. Below are some locations I checked. Running out of ideas. Any suggestion is appreciated.find_real_file.png

Email log has no error:

find_real_file.png

Attachment table shows it is attached to sys_email (??!) where it should be the scoped table

find_real_file.png

Recieved email shows the attachment is recieved 

find_real_file.png

1 ACCEPTED SOLUTION

Binglin Huang
Tera Expert

Ok, I gave up. I finally got around this by creating an inbound action in the global app. The workaround only adds one more update set to promote on top of the scoped app to another instance. I think it is not bad giving that it works.

I was trying to find out if there is a way to made it work in scoped app, but seems it is "as designed" in SN. I was chasing a ghost..

 

View solution in original post

12 REPLIES 12

Hi Huang

Can you share the inbound action you configured? Are you using current to insert/update the record in your inbound action?


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

I did not have any inbound action configured...yet

Binglin Huang
Tera Expert

Ok, I gave up. I finally got around this by creating an inbound action in the global app. The workaround only adds one more update set to promote on top of the scoped app to another instance. I think it is not bad giving that it works.

I was trying to find out if there is a way to made it work in scoped app, but seems it is "as designed" in SN. I was chasing a ghost..

 

Nick Parsons
Mega Sage

Another alternative option to creating an inbound email action is to create a flow. The following support ticket explains it in detail:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0953178

It outlines that:

"customised tables and Attachment automatically won’t move from email to target record for custom tables, unlike Incident/task table"

 

Option 1: 

The support article suggests to create a flow that triggers on an Inbound Email trigger, and then use the Move Email Attachments to Record action to move the attachments from the inbound email to your desired record:

find_real_file.png

Keep in mind the below information when using the Inbound Email trigger (source😞

Note: With other types of flows, you can choose to run as a system user or the user who initiates the session. However, inbound email flows always run as the sender of the inbound email. If the system does not recognize the sender, inbound email flows will run as the Guest user. The actions of inbound email flows are limited by user ACL restrictions. To test access controls for an inbound email flow, impersonate a typical inbound email user and manually trigger the flow.

I have found that external users replying to the email with attachments will not have their attachment added to the record if Guest does not have access to the record (this was tested in Rome).

 

Option 2:

The support article also highlights another option to getting attachments added to your record. I have found this approach to work with both internal (email exist within sys_user) and external (email doesn't exist within sys_user) users. You can create an inbound email action that updates a field on your record so that the sys_mod_count changes. Usually updating either the comments or work_notes fields to contain any text (it doesn't need to be specific text like mentioned in the support article) is a good option. Once the inbound email adds a comment (or updates the record in a way that causes the sys_mod_count field to change), the associated attachments will be added to the record also. There is no need to use the attachment API to copy the attachment (note: I am testing on a custom table that extends Task in Rome).

 

Note that the inbound email script will run as Guest if the replying user's email doesn't match a user in sys_user. When that occurs, you need to write to the comments/work_notes field in a specific way. The below won't work if Guest doesn't have write/update permissions:

current.setValue("work_notes", "Email received"); // <--- does not add work notes if script ran by user without read/write access to current

Instead, we need to use dot-notation directly (not sure why setValue() doesn't work but this does):

current.work_notes = "Email received"; // <--- does add work notes even if script is ran by a user without read access to current

Do also remember to call current.update() in your inbound email action script.

jabaya
Mega Guru

Hello Good day, 

im actually experiencing the same issue the attachments from the email i sent to the instance is not being moved/copied to the target record (incident record) 

this is what i currently have.

jabaya_0-1677086421986.png



even tho the attachments are attached from the received email.

jabaya_1-1677086476936.png


but nothing inside the incident record.

jabaya_2-1677086528394.png



any workaround for this ? aside flow.