Automatically create an incident through email for a custom application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 03:29 PM
Howdy Community,
I've been privileged with creating an inbound email action for a custom application that would generate an incident automatically.
So far, I have the inbound mail script that I want to use, my initial thought was to make it mirror the current "create incident" inbound email action and modify the script to match the fields on the custom application. I reviewed the information on the wiki for examples and read the setup information:
ref: Examples of Inbound Email Actions - ServiceNow Wiki & Inbound Email Actions - ServiceNow Wiki
I'm stuck with where to go next, where do I specify the email address that was created for the custom application? I'm trying to determine how to tie all of this together and need some guidance. We are currently running on Berlin.
Current IB email action script:
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.u_short_description = email.subject;
var sid = gs.createUser(email.from);
current.u_affected_user = sid;
current.u_status = 1;
if (email.body.assign != undefined)
current.u_assigned_to = email.body.assign;
if(email.importance != undefined)
if (email.importance == "High")
current.u_cuh_priority = 1;
if (email.body.priority != undefined)
current.u_cuh_priority = email.body.priority;
current.u_cuh_assignment_group = emailLookup(email.origemail, email.subject, 'assignment');
current.u_category.setDisplayValue(category);
current.u_status = emailLookup(email.origemail, email.subject, 'status');
current.insert();
Thanks for reading and for the advice,
Jennifer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2014 09:31 PM
Hello Jennifer,
I think you're on a right track for creating incidents. To specify that the email has come from a specific address you can use "email.from == 'address_for_this_tool'" in the condition field of your inbound action. And similarly add a condition as "email.from != 'address_for_this_tool'" in the existing inbound action, so that no duplicate incidents are created for same mail.
Also, it's worth checking the type of email being sent from the tool. If it's simple text mail like say
Number : 123
Category : some_category
then, you could use the "email.body.number" or "email.body.category" to access the values. But, in case it is a HTML table structure you will have to pull the exact data using some scripting.
I'm not sure if this is exactly what you were looking for, but i hope it helps.
Mandar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2014 01:20 PM
Hi Mandar,
Thanks for the information, however, something is still missing. I setup the notifications to notify groups and group members when an incident is assigned to them. Other notifications have been setup to notify the requestor (opened by/ affected user) when the incident is opened and closed. The problem I'm still having is with the inbound email action for the custom application. Does it make a difference whether or not the inbound action is working on a different table?
I took your advice and added the email.from address to the condition field along with the following script:
current.u_short_description = email.subject;
current.description = email.body_text;
var sid = gs.createUser(email.from);
current.u_affected_user = sid;
//current.u_affected_user = email.from;
current.u_status = 'New';
current.cuhlocation = current.u_affected_user.u_cuhlocation;
current.u_contact_number = current.u_affected_user.u_contact_number;
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if(email.importance != undefined)
if (email.importance == "High")
current.u_cuh_priority = 1;
//if (email.body.u_cuhnumber!= undefined)
current.u_cuhnumber = email.body.cuhnumber;
//Set Assignment Group (was assignment group now set CI and Issue
var assignmentGroup = emailLookup(email.origemail, email.subject);
current.u_cuh_assignment_group = emailLookup(email.origemail, email.subject, 'assignment');
current.insert();
I have access to the email account that emails will be generated from in order to create the incident. They do show up in the inbox, but not in SN in the new incidents for the custom application.
Does the email address within the notification need to reflect the email address that was setup for this application in both the "From and Reply To" field?