- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 02:32 PM
Hello All,
I am trying to assign the incident to assignment group based on the receipient email address.
we have setup like users sent email to lets say abc@domain.com which creates the incidents based on imap/smtp and inbound actions script. Incident getting created but its not assigning to automatically to assignment group (AssignmentGroup1)
my inbound action script is like below.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:23 PM
Fix below script
var recipientEmail = email.origemail;
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2024 01:12 AM - edited 04-06-2024 01:14 AM
Hi @sreenisola
I have updated the OOTB code , you can try this logic to full fill your requirement .
Inbound Action Code :
// Note: current.opened_by is already set to the first UserID that matches the From: email address
//var recipientEmail = email.from; //Option 1
//var recipientEmail = email.direct; //Option 2
var recipientEmail = email.origemail;
var assignmentGroup = determineAssignmentGroup(recipientEmail);
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.category = "inquiry";
current.incident_state = IncidentState.NEW;
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.impact = 1;
current.urgency = 1;
}
}
if (assignmentGroup) {
current.assignment_group = assignmentGroup;
} else {
gs.log("No assignment group found for incident received via email from: " + recipientEmail);
}
function determineAssignmentGroup(emailAddress) {
if (emailAddress.toLowerCase().indexOf('abc@domain.com') > -1) {
return 'sys_id_of_Assignment_group';
} else {
return false;
}
}
//if (current.canCreate())
current.insert();
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Thanks,
Subhashis Ratna

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 04:23 PM
Fix below script
var recipientEmail = email.origemail;
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2024 08:33 PM
Hi,
pls check autoassign case
If my answer is helpful pls mark helpful and correct!
Thank You!
Br,
pratiksha.k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2024 01:12 AM - edited 04-06-2024 01:14 AM
Hi @sreenisola
I have updated the OOTB code , you can try this logic to full fill your requirement .
Inbound Action Code :
// Note: current.opened_by is already set to the first UserID that matches the From: email address
//var recipientEmail = email.from; //Option 1
//var recipientEmail = email.direct; //Option 2
var recipientEmail = email.origemail;
var assignmentGroup = determineAssignmentGroup(recipientEmail);
current.caller_id = gs.getUserID();
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.category = "inquiry";
current.incident_state = IncidentState.NEW;
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.impact = 1;
current.urgency = 1;
}
}
if (assignmentGroup) {
current.assignment_group = assignmentGroup;
} else {
gs.log("No assignment group found for incident received via email from: " + recipientEmail);
}
function determineAssignmentGroup(emailAddress) {
if (emailAddress.toLowerCase().indexOf('abc@domain.com') > -1) {
return 'sys_id_of_Assignment_group';
} else {
return false;
}
}
//if (current.canCreate())
current.insert();
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Thanks,
Subhashis Ratna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 10:28 AM
I tried with single email it working. but where as same with multiple IDs it not working , am I doing something wrong here.