Schedule a report to run in specific days of the year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hello:
I have a report that should be run on specific days of the year, namely, the first day of January, April, July, October. I need help with developing the script that I could add to the Conditional setting in the report.
Many thanks in advance for your assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @jlference ,
You can use the advanced condition in scheduled report and use below script to check for first day of required months:
var today = new GlideDateTime();
var month = today.getMonthUTC() + 1; // getMonthUTC() is zero-based
var day = today.getDayOfMonthUTC();
// Run only on the 1st of Jan, Apr, Jul, Oct
return day == 1 && (month == 1 || month == 4 || month == 7 || month == 10);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @jlference
simple script condition you can use to check whether today's date matches the 1st of Jan, Apr, Jul, or Oct:
Please refer Screen shot:
Example Script:
var today = new Date();
var month = today.getMonth(); // 0 = January, 3 = April, 6 = July, 9 = October
var day = today.getDate(); // 1 = first day
// Check if today is the 1st of Jan, Apr, Jul, or Oct
if (day === 1 && (month === 0 || month === 3 || month === 6 || month === 9)) {
return true;
}
return false;
Thanks,
Vignesh
"If this solution resolves your issue, kindly mark it as correct."