Send Email Periodically 1 Hour for specific Time
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi, I have requirement to send email by using Scheduled Email Report every 1 hours but specifically between office hour 8AM until 8PM daily. Anyone can provide script or guidance on how to fulfill this requirement?
Thanks
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @Muhammad Arif B ,
check here -> https://www.servicenow.com/docs/bundle/zurich-now-intelligence/page/use/reporting/task/t_ScheduleARe...
script :-
// Get current system time and convert to local display string
var now = new GlideDateTime();
var displayTime = now.getDisplayValue();
// Use substring to grab the two-digit hour directly from 'YYYY-MM-DD HH:mm:ss'
// The hour starts at character index 11
var hour = parseInt(displayTime.substring(11, 13), 10);
// Set answer to true only if the hour is between 8 (8 AM) and 19 (7:59 PM)
if (hour >= 8 && hour < 20) {
answer = true;
} else {
answer = false;
}
