- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 10:53 AM
Hi Everyone
I would like to know if Is there a way I can route to an specific group of high/critical tickets that are received outside of normal working hours?
Scenario:
7 am to 7 pm tickets should be routed to "AAA support group"
7 pm to 7 am and weekends high/critical tickets should be routed to "BBB support group"
Your help on this will be appreciated
Fabian GR
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 07:57 AM
Neither of those will work, for two different reasons.
Use the below, EXACTLY as is:
var g = new GlideRecord('cmn_schedule');
g.addQuery('name', 'Normal working hours');
g.query();
if (g.next()) {
var sched = new GlideSchedule(g.sys_id);
var d = new GlideDateTime();
if (sched.isInSchedule(d))
current.assignment_group.setDisplayValue("C360 Ops Triage");
else
current.assignment_group.setDisplayValue("PEGA-Coverage Review");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 11:34 AM
You could take a look at on call scheduling, but it might be a bit over kill https://docs.servicenow.com/bundle/helsinki-it-service-management/page/administer/on-call-scheduling...
Or more simply you could define your schedule, in the the cmn_schedule table, then use a script like the below to detect if the current time is in the schedule:
var g = new GlideRecord('cmn_schedule');
g.addQuery('type', 'blackout');
g.query();
if (g.next()) {
var sched = new GlideSchedule(g.sys_id);
var d = new GlideDateTime();
d.setDisplayValue("2007-09-18 12:00:00");
if (sched.isInSchedule(d))
gs.info("Is in the schedule");
else
gs.info("Is NOT in the schedule");
}
Then you could potentially put the above in a assignment rule (scripted).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 01:43 PM
Thanks Andrew for your quick response, I have not idea how to define my schedule, could you please advise?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2017 01:52 PM
On your instance, in the navigation bar on the left hand side, goto: System Scheduler > Schedules.
Then click the New button to create a new schedule
Give it a name of "Normal working hours"
Save the record.
When the record reloads, on the related list of "Schedule Entries", click New
Give the new record a name of "Weekdays 7am-7pm"
In the "When" field set the hours from 07:00:00 (the date doesn't matter)
In the "To" field set the hours to 19:00:00 (same date)
In the "Repeats" field set it to "Every Weekday (Mon-Fri)"
Now you have a schedule that covers every weekday 7am to 7pm.
Then use the script above, you may need to edit it to the below:
var g = new GlideRecord('cmn_schedule');
g.addQuery('name', 'Normal working hours');
g.query();
if (g.next()) {
var sched = new GlideSchedule(g.sys_id);
var d = new GlideDateTime();
gs.info(d);
if (sched.isInSchedule(d))
gs.info("Is in the schedule");
else
gs.info("Is NOT in the schedule");
}
Which, depending on the time you run it, will either tell you the current datetime is in or out of normal working hours.
Then you can use this in a business rule or assignment rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 07:15 AM
Thanks a lot Andrew for your support on this,
I have already created a new schedule named "Normal working hours", it has related the list of schedule entries suggested
I have also created the below Assignment Rule
The assignment rule has set up the script you provided me
Unfortunately it is not working , Maybe I set up the script at the wrong way
Could you please advise?