- 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-14-2015 03:52 AM
Try this with only one inbound action . Code something like below
- // Define Caller Details
- var callerID = gs.getUser().getRecord();
- var sEmailAddress = email.origemail.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-15-2015 09:47 AM
Gurpreet,
Thank you for your response and assistance. I attempted to use the script you provided. It processes without error but the incident's are not being auto assigned to either IT Helpdesk or the IT Securities group.
What info can I provide to further assist?
Your time and assistance is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2015 12:05 AM
Hi Felix,
Try to put some log statements in the code to know the flow. If control is entering in any of the if/else conditions and still its not working then you could try to assign assignment group using sys_id of respective group.
- if (sEmailAddress.indexOf("ithelpdesk@conns.com") != -1) {
- gs.log("Email From :"+ithelpdesk@conns.com);
- current.assignment_group.setDisplayValue("IT Helpdesk"); //replace with current.assignment_group = sys_id_of_group
- }
- else if(sEmailAddress.indexOf("security@conns.com") != -1){
- gs.log("Email From :"+security@conns.com);
- current.assignment_group.setDisplayValue("IT Securities"); //replace with current.assignment_group = sys_id_of_group
- }
- 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();