- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 06:41 AM
Good morning community,
I have an inbound email action to create a new incident for failed job email notifications coming into ServiceNow and this is working great. I have an additional ask now though, where notifications coming in for the same failed job will only create a new incident if there is not an open incident for that job already within the last 12 hours.
Since there is no watermark on these inbound emails, I am uncertain on the new/reply/forward setting and the best way to implement where we search for an existing incident, and apply the new email as COMMENTS if such an email exists.
I know how to do the query for existing/open incident that matches the criteria, but I don't know how to best get the "new" email to link to the "old" but still open incident. Does anyone have similar logic they might be able to share?
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 07:03 AM
Hello,
For the new email (so inbound action is set for "New") if you know specific conditions that can help it only run/evaluate for isolated emails, that will help so that all of your emails are going through this first check.
You'd set the execution order to a lower value than the one where you have an incident become created.
Once the condition has been met, you'd proceed to the advanced/script section, there, you'd do your query to find the related record and you've said you know how to do that part.
If a match is found, you'd update the record accordingly and then add this line to stop processing (so that your other inbound action doesn't run where it creates an incident, etc.).
event.state = "stop_processing";
If no match is found, you don't do anything in the script.
Alternatively, you could merge your other inbound action where it creates a new incident for this scenario and add it to this one and have that run when there is no match found, if you do that, then you would utilize the "stop processing" checkbox on the inbound action form.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 07:03 AM
Hello,
For the new email (so inbound action is set for "New") if you know specific conditions that can help it only run/evaluate for isolated emails, that will help so that all of your emails are going through this first check.
You'd set the execution order to a lower value than the one where you have an incident become created.
Once the condition has been met, you'd proceed to the advanced/script section, there, you'd do your query to find the related record and you've said you know how to do that part.
If a match is found, you'd update the record accordingly and then add this line to stop processing (so that your other inbound action doesn't run where it creates an incident, etc.).
event.state = "stop_processing";
If no match is found, you don't do anything in the script.
Alternatively, you could merge your other inbound action where it creates a new incident for this scenario and add it to this one and have that run when there is no match found, if you do that, then you would utilize the "stop processing" checkbox on the inbound action form.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 07:04 AM
Hi,
Thank you for marking my reply as Helpful.
If it ends up also guiding you Correctly, please also mark as Correct.
Thanks and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2022 07:49 AM
Thank you for your help on this. I used the separate action running prior, and used the stop processing flag as you noted. For reasons I did not try to figure out, I had trouble combining the two into one. Creating an update action first though, worked great.
Thanks for your help.