Inbound email action on cc field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2015 02:12 AM
We use the below script as an inbound email action for when users email our Service Desk it directs it to the correct queue based on region.
It works fine when the email address is in the To field. However, if the regional Service Desk email is in a cc field it always assigns the calls to the UK Service desk.
I am trying to figure out what i need to change so even if the email is in a cc field it still uses the inbound action to assign it to the correct group.
Any Thoughts?
// | Note: current.opened_by is already set to the first UserID that matches the From: email address |
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.description = email.body_text;
current.location = current.caller_id.location;
//current.category = "request";
current.incident_state = 1;
current.notify = 2;
current.contact_type = "email";
if (email.body.assign != undefined)
current.assigned_to = mail.body.assign; |
/*if (email.importance != undefined) {
if (email.importance == "High") | ||
current.priority = 1; |
}*/
if (email.body.priority != undefined)
current.priority = email.body.priority; |
fillAssignmentGroup();
current.insert();
function fillAssignmentGroup() {
try { | |||||||
var subject= email.subject.toLowerCase(); | |||||||
var record = new GlideRecord('u_email_assignment_lookup'); | |||||||
record.addQuery('active', true); | |||||||
record.query(); | |||||||
while(record.next()){ | |||||||
if(subject.indexOf(record.u_text.toLowerCase())>=0) { | |||||||
current.assignment_group = record.u_group; | |||||||
return; | |||||||
} | |||||||
} | |||||||
//Euromoney changes | |||||||
if (email.direct.indexOf('itservicedesk@euromoneyplc.com') > -1) | |||||||
current.assignment_group=gs.getProperty('em.uk.inbound.email.assignment'); | |||||||
else if (email.direct.indexOf('itservicedeskus@institutionalinvestor.com') > -1) | |||||||
current.assignment_group=gs.getProperty('em.us.inbound.email.assignment'); | |||||||
else if (email.direct.indexOf('riaz.jones@euromoneyplc.com') > -1) | |||||||
current.assignment_group=gs.getProperty('em.ukfin.inbound.email.assignment'); | |||||||
else if (email.direct.indexOf('ithelpdesk@euromoneyasia.com') > -1) | |||||||
current.assignment_group=gs.getProperty('em.hk.inbound.email.assignment'); | |||||||
else | |||||||
current.assignment_group=gs.getProperty('em.uk.inbound.email.assignment'); | |||||||
//Test | |||||||
//if(email.from.indexOf('usman.farooq@fruitionpartners.com') > -1) | |||||||
// | current.assignment_group = gs.getProperty('em.uk.inbound.email.assignment'); | ||||||
}catch (err) | |||||||
{ | |||||||
jslog("Email Inbound Action: (fru) Create Incident: caught error: " + err,"+++ FPlogging") ; | |||||||
} |
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2015 06:45 AM
Looks like email.copied takes a look at the CC box.
Inbound Email Actions - ServiceNow Wiki
From there you could probably either do more IF statements, or maybe combine the To and CC fields and do some sort of indexOf on both of them to try and find the different departments.