Inbound Email Action Condition for Recipient

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2012 11:12 PM
I am attempting to have an Inbound Email Action condition filter and process my email based on the address the sender sent it to, i.e., the address which forwarded it to SN. This intermediary address is properly appearing in the email log record in both the Recipients field and the To field. This will create a record on a table other than incident.
Here are the condition alternatives I have tried with no success.
email.direct.indexOf('1@1.co') > -1
email.direct.indexOf("1@1.co") > -1
email.direct.indexOf('1@1.co') >= 0
email.direct.indexOf("1@1.co") >= 0
email.to.indexOf('1@1.co') > -1
email.to.indexOf("1@1.co") > -1
email.to.indexOf('1@1.co') >= 0
email.to.indexOf("1@1.co") >= 0
email.recipients.indexOf('1@1.co') > -1
email.recipients.indexOf("1@1.co") > -1
email.recipients.indexOf('1@1.co') >= 0
email.recipients.indexOf("1@1.co") >= 0
Thank you in advance for your assistance. -Bill
- Labels:
-
Orchestration (ITOM)
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2012 08:54 AM
indexOf is case sensitive, so that's something to check. you can add toLowerCase() to force everything to lowercase
email.direct.toLowerCase().indexOf("email@somewhere.com") > 0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2012 01:48 PM
Brad, Thank you for the reply. I found an error/oversight in my script, missing "}" which was preventing it from working, i.e., creating new records. However, in my incident inbound (below) I have not been able to exclude this email.direct address. I was able to do it through the condition, but not through the script.
gs.print("-----------RUNNING CREATE INCIDENT (All) EMAIL ACTION------------------------");
// Messages from XX. are handled by someone else
// Check for those and do not do anything here
var skipmsg = false;
if ((email.origemail.indexOf("noreply@somewhere.com") >= 0) ||
(email.direct.indexOf("email@somewhere.com") >= 0) ||
((email.origemail.indexOf("SJ-5600") >= 0) && (email.origemail.indexOf("@somewhere.com") >= 0)) ||
(email.origemail.indexOf("@savvis.net") >= 0) ||
(email.copied.indexOf("258372@somewhere.com") >= 0) ||
(email.copied.indexOf("helpdesk@somewhere.com") >= 0) ||
(email.subject.indexOf("nj-cmsdrweb1/JRUN/Log Error") > -1) ||
(email.body_text.indexOf("news.insert") > -1))
{
skipmsg = true;
}
if (!skipmsg) {
gs.print("-----------RUNNING Normal Create Incident as it is non of many listed in rule -----------------------");
var sid = gs.createUser(email.from);
current.work_notes = "Processed by Inbound email action [Create Incident (All)]";
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.caller_id = sid;
current.opened_by = sid;
current.location = current.caller_id.location;
current.incident_state = 1;
current.priority = 4;
current.notify = 2;
current.category = "Service";
current.company = current.caller_id.company;
current.u_creation_type = "Email";
if (email.body.a != undefined)
{
current.assigned_to.setDisplayValue(email.body.a);
}
current.assigned_to = email.body.a;
}
if (email.body.ag != undefined)
{
current.assignment_group.setDisplayValue(email.body.ag);
}
if (email.body.c != undefined)
{
current.category.setDisplayValue(email.body.c);
}
if (email.body.t != undefined)
{
current.subcategory.setDisplayValue(email.body.t);
}
if (email.body.i != undefined)
{
current.u_item.setDisplayValue(email.body.i);
}
if (email.body.p != undefined)
{
current.parent.setDisplayValue(email.body.p);
}
if (email.body.u != undefined)
{
current.urgency.setDisplayValue(email.body.u);
}
if (email.body.im != undefined)
{
current.impact.setDisplayValue(email.body.im);
}
if (email.body.user != undefined)
{
current.caller_id.setDisplayValue(email.body.user);
}
if (email.body.ci != undefined)
{
current.cmdb_ci.setDisplayValue(email.body.ci);
}
if (email.body.incs != undefined)
{
current.incident_state = email.body.incs;
}
if (email.body.wn != undefined)
{
current.work_notes.setDisplayValue(email.body.wn);
}
if (email.body.wl != undefined)
{
current.watch_list.setDisplayValue(email.body.wl);
}
if (email.importance == "high")
{
current.urgency = 1;
current.priority = 3;
}
current.insert();