How to detect weekend days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 08:47 AM
I got a requirement -all incident are opened during weekend , their State field must be set to "New". However, their State value -"New" must be converted to "Active" if date is coming to Weekday (Monday - Friday). How can I monitor the date change among Weekend to Weekday?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 01:29 PM
How can we check on time: Business hour 7:00 am - 7:00 pm in Scheduled Job script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 01:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 03:42 PM
Hi nancy,
you might want to try out this script between your execute rule
var gdt = new GlideDateTime();
var day = gdt.getDayOfWeekLocalTime();
if(day == 6 || day == 7) {
current.incident_state = 1;
} else {
var dateAndTime = gdt.toString().split(" ");
var time = dateAndTime[1].split(":");
var hour = time[0];
if (hour >= 7 && hour < 20 ) {
current.incident_state = 2;
} else {
current.incident_state = 1;
}
}
Thanks
Venkat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 04:38 PM
It worked. Thank you for your support, Venkat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2016 06:53 PM
Thank you for your explanation.
I had understood the requirement, but I was interested in the thought process behind why this kind of configuration is needed.
Normally, your incident created moves to "New" state irrespective of the day. In most of the implementations, moving state to "Active" is the indication for "Completion of Response SLA".