Scheduled report running incorrectly—triggering weekly instead of quarterly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 11:33 PM
Hello Team,
"I have created a scheduled report that is supposed to run on the second Monday of each quarter for the vulnerability table. However, it is incorrectly triggering on the first Monday of every week. Could you please help me resolve this issue?"
Please find the script which i have mentioned in scheduled report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 11:38 PM
Hi @Sireesha7 ,
Try the below code:
var gdt = new GlideDateTime(); // Current date-time
var month = gdt.getMonth(); // 0-based: Jan = 0, Apr = 3, Jul = 6, Oct = 9
var day = gdt.getDayOfMonth(); // Day of the month
var dayOfWeek = gdt.getDayOfWeek(); // 1 = Monday, 7 = Sunday
// Check if today is the second Monday of the quarter (Jan, Apr, Jul, Oct)
//change in below line
if (dayOfWeek == 1 && (month == 0 || month == 3 || month == 6 || month == 9) && day > 7 && day <= 14) {
answer = true;
} else {
answer = false;
}
If my response helped, please mark it correct and close the thread so that it benefits future readers.
Regards,
Mohd Arbaz.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 10:12 PM
Hi @mohdarbaz ,
Thanks for your response, But unfortunately, the code is not working.
Could you please check and do the needful?
Thanks & Regards,
Sai Sireesha G