Create multiple ticket using one inbound email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2023 06:07 AM
I have a requirement, for the incoming email using inbound action, multiple tickets should be created for Purchasing table. The condition depend on the attachment of the incoming email. So inbound action have to check, if incoming email have more than one pdf attachments, those many number of records need to get created. And instead of getting all attachments coming with the incoming email, getting attached to one single record, this should attach individual PDF doc to corresponding tickets. For example: PDF1 should only be attached to Ticket1, PDF2 should be attached to Ticket2 and so on.
I have been able to implement first half of requirement, I am looking for some help for second half, where I need to frst stop the OOB functionality to attach all incoming attachments to get attached to the target record. Secondly I have to query these PDF files and attach it one on one.
Major Challenge: Due to OOB functionality within after few minutes of inbound action getting trigger, the table sys_id value of the attachment table changes from that of incoming sys_email record to the target record,where all the attachment gets attached. I have details of these attachments available in sys_email_attachment table but from there I am unable to copy the attachment individually to the target record getting created.
I have attached the code snippet, please suggest how can I achieve the requirement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2023 06:16 AM
Hi @stayyaba,
I would advise you to start working with Flow designer for this requirement.
Use the inbound email trigger. This way you can use all the handy actions such as looping through attachments which makes creating this a lot easier than doing it with an inbound action.
Create a flow with an inbound email trigger (servicenow.com)
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2023 12:13 AM
Hi Peter,
Thanks for the suggestion, unfortunately I am half through this requirement, managed to create multiple tickets basis of the condition. That part is pushed to UAT for testing. So going back and using the flow designer approach not be a better idea in regards to time constraint, Currently I am looking for a solution for avoiding all attachments getting attached and only each pdf to get attached to each newly created ticket. Kindly share some insights on the same if possible.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2023 12:49 AM
In my experience it often is very rewarding to start again, but in case you don't want to, take a look at this article, it may help you to copy attachments one by one.
Advanced Attachment Copy Util - ServiceNow Developer Pro-Tips (snprotips.com)
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2023 04:00 AM
Hi Peter, I have tried using glidesysattachment copy function in my code, but that doesnt seem to work. Kindly refer to the attachment.
Also could you please suggest if I use the flow designer approach will it be able to attach individual files to each ticket? If you could share any working example it would be great. I have only worked with approval flows in flow designer so dont have much insights. Thanks!