- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2014 11:21 AM
We have the below Inbound Action started and we'd like to base the Incident Priority on the time the email is received. If, the email is received after normal business hours (after 5pm or weekends) then we want the priority to be a 1, instead of a priority 3.
email.subject.toString().indexOf('Gentran Notification: Inbound Data Issue') ==0
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
current.description = email.body_text;
current.contact_type = 'email';
current.opened_by = 'AUTO OPEN';
current.caller_id = 'AUTO OPEN';
current.category = "Data Center/Infrastructure";
current.subcategory = "Facilities";
current.incident_state = 1;
current.priority = 3;
current.assignment_group.setDisplayValue('Command Ctr');
current.insert();
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2014 07:16 AM
I thought about this for a little while, but couldn't think of a relatively easy way to get the weekends and outside normal business hours. Using an assignment rule for the weekend is easy to set up without having to modify the inbound email action, and you can add/remove conditions as fit to better match the inbound emails.
As for the time of day, I wrote a rather inelegant, simple script to check the incoming time of the email. If you remove or comment out the "current.priority = 3;" line in the inbound action, you can stick this snippet before the "current.insert();" and that should take care of it.
// Grab the hour value from the gs.nowDateTime() function
// returns as a value 0-23
var time = gs.nowDateTime().split(" ")[1];
var hour = time.split(":");
var finalHour = parseInt(hour[0],10);
// Set the number equivalent to hours of normal business hours (8 = 8 AM, 17 = 5 PM)
// Make sure to manually check instance time
var a = 8;
var b = 17;
if ( (a > finalHour) || (finalHour > b)){
//Outside of business hours
current.priority = 1;
}
else{
current.priority =3;
// Inside normal business hours
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2014 03:57 PM
Hi,
For better visibility, I moved your question from the Community Updates & Feedback area to the Implement sub-community.
thanks,
Lawrence
--
Online Community Program Manager, ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2014 07:16 AM
I thought about this for a little while, but couldn't think of a relatively easy way to get the weekends and outside normal business hours. Using an assignment rule for the weekend is easy to set up without having to modify the inbound email action, and you can add/remove conditions as fit to better match the inbound emails.
As for the time of day, I wrote a rather inelegant, simple script to check the incoming time of the email. If you remove or comment out the "current.priority = 3;" line in the inbound action, you can stick this snippet before the "current.insert();" and that should take care of it.
// Grab the hour value from the gs.nowDateTime() function
// returns as a value 0-23
var time = gs.nowDateTime().split(" ")[1];
var hour = time.split(":");
var finalHour = parseInt(hour[0],10);
// Set the number equivalent to hours of normal business hours (8 = 8 AM, 17 = 5 PM)
// Make sure to manually check instance time
var a = 8;
var b = 17;
if ( (a > finalHour) || (finalHour > b)){
//Outside of business hours
current.priority = 1;
}
else{
current.priority =3;
// Inside normal business hours
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2014 07:42 AM
Thank you so much, I'll give that a try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2014 11:51 AM
just be aware that if you are basing your priority on Impact and Urgency (lookups) calculation, then you should set the urgency and impact in the inbound action, and let the Priority get calculated as normal. I wondered why mine wasn't working right 🙂