- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 10:59 AM
Hello,
I need to populate the assignment group field in the incident form by using either BR, assignment rule or an inbound email action based on the callers location as I assign a different group based on location. Nothing I have tried is populating this field.
I have tried every approach and I had it working and now it no longer works.
Here is what I tried for assignment rule
if (current.caller_id.city == "Cincinnati")
current.assignment_group.setDisplayValue("Local Services - Cincinnati");
else if (current.caller_id.city == "Columbus")
current.assignment_group.setDisplayValue("Local Services - Columbus");
else if (current.caller_id.city == "Cleveland")
current.assignment_group.setDisplayValue("Local Services - Cleveland");
else if (current.caller_id.city == "Dayton")
current.assignment_group.setDisplayValue("Local Services - Dayton");
else if (current.caller_id.city == "Chicago")
current.assignment_group.setDisplayValue("Local Services - Chicago");
else if (current.caller_id.city == "Indianapolis")
current.assignment_group.setDisplayValue("Local Services - Indianapolis");
else {
current.assignment_group.setDisplayValue("Enterprise Customer Support");
}
TABLE: Incident
Conditions: Category = IT - Helpdesk
Contact Type = Email
Does not populate assignment rule
-------------------------------------------------------------------------------------------
Inbound Email Action I tried:
if(email.recipients.indexOf('onboardingtest@mycompanyemail.com') > - 1){
gs.log('Create new incident');
gs.log('gr.caller_id.email ' + current.caller_id.email);
gs.log('email from ' + email.from);
var gr = new GlideRecord('sys_user');
gr.addQuery('email', email.from);
gr.query();
if (gr.next()) {
// It's a user
// It's a user
current.caller_id = email.from;
current.description = email.body_text;
current.short_description = email.subject;
current.caller_id.city = email.from.city;
current.category = "IT - Helpdesk";
current.incident_state = 1;
current.contact_type = "email";
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
var ag = current.caller_id.city;
ag = String(ag);
gs.log(" AG is ? "+ ag );
switch(ag){
case 'Cincinnati':
var c = 'Local Services - Cincinnati';
assignment_group = c;
current.assignment_group = 'c370fe4537145280dc1ca6d2b3990e4a';
gs.eventQueue('new_call.alert.localcincy', current,gs.getUserID(),gs.getUserName());
break;
case 'Chicago': var c ='Local Services - Chicago';
current.assignment_group = c;
gs.eventQueue('new_call.alert.localchicago', current,gs.getUserID(),gs.getUserName());
break;
case 'Columbus': var c ='Local Services - Columbus';
current.assignment_group = c;
gs.eventQueue('new_call.alert.localcolumbus', current,gs.getUserID(),gs.getUserName());
break;
case 'Cleveland': var c ='Local Services - Cleveland';
current.assignment_group = c;
gs.eventQueue('new_call.alert.localcleveland', current,gs.getUserID(),gs.getUserName());
break;
case 'Dayton': var c ='Local Services - Dayton';
current.assignment_group = c;
gs.eventQueue('new_call.alert.localdayton', current,gs.getUserID(),gs.getUserName());
break;
case 'Indianapolis': var c ='Local Services - Indianapolis';
current.assignment_group = c;
gs.eventQueue('new_call.alert.localindy', current,gs.getUserID(),gs.getUserName());
break;
default: var c ='Enterprise Customer Support';
current.assignment_group = c;
gs.eventQueue('new_call.alert.enterprisesupport', current,gs.getUserID(),gs.getUserName());
}
//current.category = "request";
current.state = 1;
//current.notify = 2;
current.contact_type = "email";
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined)
current.priority = email.body.priority;
current.insert();
}else{
current.description = '---Warning, This caller was not recognized. Dumping email data below: --- ' + ' Recipients of this email: ' + email.recipients + ' ' + ' Email Body: ' + email.body_text;
current.short_description = email.subject;
var c ='Enterprise Customer Support';
current.u_assignment_group = c;
gs.eventQueue('new_call.alert.enterprisesupport', current,gs.getUserID(),gs.getUserName());
current.insert();
}
//ASSIGNMENT RULE
//current.category = "request";
current.state = 1;
//current.notify = 2;
current.contact_type = "email";
if (email.body.assign != undefined){
current.assigned_to = email.body.assign;
}
if (email.importance != undefined) {
if (email.importance.toLowerCase() == "high")
current.priority = 1;
}
if (email.body.priority != undefined){
current.priority = email.body.priority;
gs.log('email recipients:' + email.recipients);
}
gs.log('email recipients:' + email.recipients);
gs.log('end of create incident inbound action');
current.update();
}
I would appreciate any help!
Thank You,
Steele
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 01:38 PM
Adding this to my Inbound email action solved all my issues
current.caller_id = gr.sys_id;
current.caller_id.city = gr.city;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 12:04 PM
Note: I changed the inbound action so it is not trying to assign an assignment group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 01:04 PM
I've figured out that
current.caller_id.city is undefined in my inbound email action and that is causing all my issues and causing me to have to try and workaround it.
I can confirm the user has a city and this code has worked before. I am confused on why current.caller_id.city is coming up undefined on the incident table.
Steele
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2016 01:38 PM
Adding this to my Inbound email action solved all my issues
current.caller_id = gr.sys_id;
current.caller_id.city = gr.city;