Hi all
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 03:10 AM
scheduled job first monday of every year condition servicenow
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 03:28 AM
Hi @basha shaik ,
Hope below sample script helps you
var now = new GlideDateTime();
var dayOfWeek = now.getDayOfWeekLocalTime(); // 1=Monday, 2=Tuesday, ..., 7=Sunday
var dayOfYear = now.getDayOfYearLocalTime(); // Day of the year (1-365 or 1-366 for leap years)
// Check if it's the first Monday of the year
if (dayOfWeek == 1 && dayOfYear <= 7) {
// Your job logic here
}
Thanks,
Pradeep