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
‎11-05-2015 03:57 PM
Hi Nick,
It looks to me like your field mappings are off a bit. For example, you have:
if(email.body.assignedto != undefined) {
current.sys_id = email.body.assignedto;
In a normal instance of SN, the actual field for assigned to is: assigned_to
if (email.body.assign != undefined) {
current.assigned_to = email.body.assign;
}
In a normal instance of SN, the actual field for configurationitem is: cmdb_ci
I would suggest checking the Incident form to get the exact (correct) field names for all of the items you are attempting to populate and update your script with the correct field names. The field names must be exactly correct or they won't populate correctly.
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 04:43 AM
Thanks, Chandra. I will give that a look and come back with results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2015 06:02 AM
After sending a number of test emails, tinkering here and there, I finally got on the right track. Going back to your response about getting the proper syntax relative to the way our incident table is set up helped.
I found for some form reference fields, I had to use the sys_id for it to parse properly in the incident form; pulling the name from the sending email would not parse for some reason. I suppose each SN instance is unique!
I misled myself by misinterpreting the statement in the wiki as well as the other SN community thread about the inbound email needing to be plain text ( though I am sending these test emails as plain text ).
Note:
The action always generates a lowercase variable name. Note also that this functionality does not work on reference fields.
Anyways, this is what I have the current inbound email body set as and parsing properly in incident fields, reference type or free text:
room:501
assignedto:Nicholas Skaggs
configitem:092dd92f09b405001e1cfb301019335a
assigngroup:d7bc71eec5a2c900fadf7cf8915b2ea0
IssueOwner:Nicholas Skaggs
ShortDescription:Self-service - implement Web Snapshot
And this is the IA script:
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.incident_state = 1;
current.notify = 2;
current.contact_type = "email";
if (email.body.shortdescription != undefined) {
current.short_description = email.body.shortdescription;
}
if (email.body.room != undefined) {
current.u_room = email.body.room;
}
if (email.body.assignedto != undefined) {
current.assigned_to = email.body.assignedto;
}
if (email.body.configitem != undefined) {
current.cmdb_ci = email.body.configitem;
}
if (email.body.assigngroup != undefined) {
current.assignment_group = email.body.assigngroup;
}
if (email.body.issueowner != undefined) {
current.caller_id = email.body.issueowner;
}
current.insert();
event.state="stop_processing";
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 01:12 PM
I think I found my problem. All the fields I want SN to populate from the inbound email are reference fields in the incident form. This functionality is not possible on ref fields.