Inbound Email Actions "Create Incident" Assignment group not populating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 01:46 AM
Hi Everyone
I have the following Inbound email Actions "Create Incident" action where i am trying to assign a ticket to whichever assignment group that gets pulled from the inbound email. The script i have changes the mandatory to grey and looks like its trying to reference the assignment group reference field, however its doesn't display the assignment group in the instance, can someone please advise on the corrected code ?
Thank you
Sue
My code is below:
// 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.category = "inquiry";
current.incident_state = IncidentState.NEW;
//current.notify = 2;
//current.contact_type = "email";
if (email.body.assignment_group != undefined)
current.assignment_group = email.body.assignment_group;
if (email.body.description != undefined)
current.description = email.body_text;
if (email.body.contact_type != undefined)
current.contact_type = email.body.contact_type;
if (email.body.category != undefined)
current.category = email.body.category;
if (email.body.subcategory != undefined)
current.subcategory = email.body.subcategory;
if (email.body.priority != undefined) {
if (email.importance.toLowerCase() == "high") {
current.impact = 1;
current.urgency = 1;
}
}
if (current.canCreate())
current.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 11:28 AM
Can you add the following line at the beginning of the script?
gs.info("Email object is " + JSON.stringify(email, null, '\t') );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:25 AM
Try inbound email flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:37 AM
I want to use inbound actions for the process.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:26 AM
Hi @Kays,
The below script might become helpful. Please try check if the group exists on the group table or not using the below script.
current.assignment_group = getAssignmentGroup();
function getAssignmentGroup() {
var groupName = email.body.assignment_group;
var grGroup = new GlideRecord('sys_user_group');
grGroup.addQuery('name',groupName);
grGroup.setLimit(1);
grGroup.query();
if(grGroup.next()) {
return grGroup.getUniqueValue();
}
}
Regards,
Deepak Kandiboina
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 02:36 AM
Hi Deepak,
I i am running this in background scripts then i am getting an error
Thanks