Set Incident Urgency based off Caller Group (Emailed Incidents)

nickm5816667392
Tera Contributor

We currently allow users to open incidents by emailing our instance. These incidents are low impact/urgency/priority by default. 

 

We're looking to automatically set the Urgency to High in the event one of our VIP users sends this email. These VIP users exist in an AD security group that syncs with ServiceNow.

 

We're running Yokohama. Hoping there is something OOB we can rely on. Thanks in advance!

1 ACCEPTED SOLUTION

@nickm5816667392 

you can check if the user who is responding is member of that group

something like this but please enhance

//  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.description = email.body_text;
current.short_description = email.subject;


if(gs.getUser().isMemberOf('Group ABC')){
    current.priority = 2; // high
}

current.category = "inquiry";
current.incident_state = IncidentState.NEW;
current.notify = 2;
current.contact_type = "email";
//current.assignment_group = 'ff796f1847314a1006ec046fe16d4379';
/*
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 (current.canCreate())*/
current.insert();

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

15 REPLIES 15

@nickm5816667392 

Glad to help.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader