Inbound Action Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2015 10:27 AM
Using Eureka
I am trying to craft an inbound action script to scrub the body of an inbound email and create an incident with the desired fields populated and routed to the appropriate groups.
Below is the inbound email; body starts on line 6:
From: Reports Issues [mailto:contoso@contoso.com]
Sent: Wednesday, October 28, 2015 12:43 PM
To: <person@contoso.com
Subject: Import Banner IssueIssueId: 4221
Priority: 3 - Moderate
State: Work In Progress
Product: Banner
ConfigurationItem: Banner
AssignmentGroup: Banner Financial Aid
AssignedTo: Person Assigned
AssignedToEmail: person1@contoso.com
IssueOwner: Tess Passey
IssueOwnerEmail: person2@contoso.com
ShortDescription: Self-service - implement Web Snapshot
Description: want to look into implementing Web Snapshot. should be a part of FA Self-Service release 8.12.
DateCreated: 01/06/2012
This is the inbound action I have created thus far, but I don't think I am interpreting the wiki info to route these correctly:
- current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
- current.short_description = email.subject;
- current.incident_state = 1;
- current.notify = 2;
- current.contact_type = "email";
- current.caller_id = gs.getUserID();
if(email.body.configurationitem != undefined) {
current.tsnoc = email.body.configurationitem;
}
if(email.body.assignmentgroup != undefined) {
current.d7bc71eec5a2c900fadf7cf8915b2ea0 = email.body.assignmentgroup;
}
if(email.body.assignedto != undefined) {
current.d4dece082b9501001e1c5dd417da15e1 = email.body.assignedto;
}
- current.insert();
- event.state="stop_processing";
I already have some basic IA's working, but those do not get much more detailed than the basics:
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.incident_state = 1;
current.notify = 2;
current.contact_type = "email";
current.caller_id = gs.getUserID();
current.assignment_group = 'f8657087492ab1001e1ca684059595bc';
current.insert();
event.state="stop_processing";
For the 'if' statements, they are not reading properly and thus not designating the appropriate fields in a new incident. Any insight is appreciated!
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 02:01 PM
Hi Ewan,
Did you use Chris' suggestion to use current.assignment_group.setDisplayValue() rather than direct assignment? Given that the inbound value for assignment group int hat email is "Infrastructure" rather than they sys_id of the Infrastructure group, you can't use direct assignment (reference fields have a value- a sys_id, and a display value- like a name). Since you're getting the name in your email, you need to either try setting that (and let the system look up an appropriate sys_id for a group with that name), or explicitly do the query yourself, find the right group, and assign it's sys_id to current.assignment_group.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2016 03:33 PM
That was it! Thanks Cory.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2017 09:26 AM
Hi Ewan,
I've been tinkering with an IA similar to this and found the following useful: current.caller_id = getUser("Jane.Doe");
The requirement I had was to assign the caller ID field to always insert a user's name. In this case, a Cognos report would send an email to Servicenow and our settings would create the incident with 'guest' as the caller ID. We found a way to accept the email, but have the IA assigned Jane Doe as the caller ID and not guest.
To make it work fully, a function needed to be added at the end of the IA script to make it work:
function getUser(u_name)
{
var a=new GlideRecord("sys_user");
a.addQuery("user_name",u_name);
a.query();
if(a.next()){
return a.sys_id;