- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2015 10:04 AM
Hello all.
My company has a need to set up logic to auto assign the assignment group based on the email the request was sent to.
For isntance, if the email is sent to security@conns.com we want the assignment group changed to Security. If sent to our ITHelpdesk@conns.com email we want it sent to auto assign to ITHelpdesk.
I had attempted to achieve this with inbound email actions but ran into an issue with auto assigning everything to Security assignment group.
Please advise how I could achieve this. I was using a combination of two actions but am sure it can be achieved with just one.
The first "Create Security" inbound action below specifies to auto assign Security group based on email.
Condition: emailTo.indexOf("security@conns.com") >=0
// Define Caller Details
var callerID = gs.getUser().getRecord()
current.caller_id = callerID.getValue('sys_id');
current.location = callerID.getValue('location');
current.u_phone_number = callerID.getValue('phone');
current.contact_type = 'email';
// Define Incident Details
current.assignment_group.setDisplayValue("IT Securities");
current.status = 1;
current.short_description = email.subject;
current.description = email.body_text;
current.insert();
_____________________________
The intent of "Create Incident" inbound action was to create incidents for those not sent to Security@conns.com
// Define Caller Details
var callerID = gs.getUser().getRecord();
var sEmailAddress = email.origemail.toLowerCase();
if (sEmailAddress.indexOf("security@conns.com") >= 0) {
current.caller_id = callerID.getValue('sys_id');
current.location = callerID.getValue('location');
current.u_phone_number = callerID.getValue('phone');
current.contact_type = 'email';
// Define Incident Details
current.assignment_group.setDisplayValue("IT Helpdesk");
current.status = 1;
current.short_description = email.subject;
current.description = email.body_text;
current.insert();
}
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 02:15 AM
Okay, we were checking for from address but you mentioned that assignment should be on basis of To Address. Following code should work.
- // Define Caller Details
- var callerID = gs.getUser().getRecord();
- var sEmailAddress = email.direct.toLowerCase();
- if (sEmailAddress.indexOf("ithelpdesk@conns.com") != -1) {
- current.assignment_group.setDisplayValue("IT Helpdesk");
- }
- else if(sEmailAddress.indexOf("security@conns.com") != -1){
- current.assignment_group.setDisplayValue("IT Securities");
- }
- current.caller_id = callerID.getValue('sys_id');
- current.location = callerID.getValue('location');
- current.u_phone_number = callerID.getValue('phone');
- current.contact_type = 'email';
- // Define Incident Details
- current.status = 1;
- current.short_description = email.subject;
- current.description = email.body_text;
- current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 08:10 AM
This worked exactly as need. I appreciate your assistance very much.
One final question, if I wanted to expand on this script in the future, can you provide a template where I modify and include the new email / assignment group code?
// Define Caller Details
var callerID = gs.getUser().getRecord();
var sEmailAddress = email.direct.toLowerCase();
if (sEmailAddress.indexOf("ithelpdesk@conns.com") != -1) {
current.assignment_group.setDisplayValue("IT Helpdesk");
}
else if(sEmailAddress.indexOf("security@conns.com") != -1){
current.assignment_group.setDisplayValue("Security");
}
current.caller_id = callerID.getValue('sys_id');
current.location = callerID.getValue('location');
current.u_phone_number = callerID.getValue('phone');
current.contact_type = 'email';
// Define Incident Details
current.status = 1;
current.short_description = email.subject;
current.description = email.body_text;
current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2015 11:02 PM
You just need to add else if condition for new assignment group
// Define Caller Details
var callerID = gs.getUser().getRecord();
var sEmailAddress = email.direct.toLowerCase();
if (sEmailAddress.indexOf("ithelpdesk@conns.com") != -1) {
current.assignment_group.setDisplayValue("IT Helpdesk");
}
else if(sEmailAddress.indexOf("security@conns.com") != -1){
current.assignment_group.setDisplayValue("Security");
}
else if(sEmailAddress.indexOf("newAddress@conns.com") != -1){
current.assignment_group.setDisplayValue("New Group");
}
current.caller_id = callerID.getValue('sys_id');
current.location = callerID.getValue('location');
current.u_phone_number = callerID.getValue('phone');
current.contact_type = 'email';
// Define Incident Details
current.status = 1;
current.short_description = email.subject;
current.description = email.body_text;
current.insert();