Change the time zone to trigger the notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
22 hours ago
In our current setup, the ServiceNow instance operates in the IST (Indian Standard Time) zone. A business rule was implemented to monitor incident creation for a specific domain. The rule triggers a notification when 25 incidents are created in a single day for a specific caller.
Initially, the rule was designed to evaluate incidents based on IST. However, since our clients operate in the US/Eastern time zone, the notification logic needed to be aligned with their local time.
To address this, the business rule was updated to calculate the start and end of the day based on US/Eastern time, and convert those values to UTC for accurate querying. This ensures that the notification is triggered correctly when 25 incidents are created within the same calendar day as per US/Eastern time.
SCRIPT IN BUSINESS RULE :
(function executeRule(current, previous /*null when async*/) {
// Get current date/time in US/Eastern
var easternTZ = 'America/New_York';
var now = new GlideDateTime();
now.setTZ(easternTZ);
// Get beginning and end of "today" in US/Eastern
var startOfDay = new GlideDateTime(now);
startOfDay.setDisplayValueInternal(startOfDay.getDate() + ' 00:00:00');
startOfDay.setTZ(easternTZ);
var endOfDay = new GlideDateTime(now);
endOfDay.setDisplayValueInternal(endOfDay.getDate() + ' 23:59:59');
endOfDay.setTZ(easternTZ);
// Convert to UTC for querying
var startUTC = startOfDay.getValue(); // returns UTC time
var endUTC = endOfDay.getValue();
var gr = new GlideAggregate('incident');
gr.addEncodedQuery('sys_domain=xyz^sys_created_on>=' + startUTC + '^sys_created_on<=' + endUTC + '^caller_id=yyy');
gr.addAggregate('COUNT');
gr.query();
if (gr.next()) {
var count = parseInt(gr.getAggregate('COUNT'), 10);
if (count == 25) {
gs.eventQueue('it.checkmate.incident.limit.reached', current);
}
}
})(current, previous);
but it's not working, can anyone please help on this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
20 hours ago
Good day,
As an FYI, you can simplify this by leveraging the GlideScheduleDateTime API to convert date/time values based on timezones. For example, the below will get the UTC time window for the eastern timezone.
This could simplify your BR
var sdtTZ = new GlideScheduleDateTime('08/10/2025 00:00:00');
var timeStart = sdtTZ.convertTimeZone('America/New_York' , 'UTC')
gs.info(timeStart); //"08/10/2025 04:00:00"
var sdtTZ = new GlideScheduleDateTime('08/10/2025 23:59:59');
var timeEnd = sdtTZ.convertTimeZone('America/New_York' , 'UTC')
gs.info(timeEnd); //"09/10/2025 03:59:59"