- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:27 PM
Hi,
How to get first Monday/ Tuesday/Wednesday/Thursday of every month for scheduling the report.
I need to scheduled the report first Monday of every month.
I have tried below script it's working but there is error here that take a example : I have scheduled one report it has to be generate on second Tuesday midnight every month but it's generated first Tuesday of the month. Ex: April 7th 2020 is First Tuesday of the month and I need the report should generate on second Tuesday of the month means 14th April 2020. Please help me on this if there is any thing need to change.
var prefixes = ['First', 'Second', 'Third', 'Fourth', 'Fifth'];
var result;
var gdt = new GlideDateTime();
var day = gdt.getDayOfWeek();
var week = gdt.getDayOfMonthLocalTime();
result = true;
} else {
result = false;
}
return result;
}
checkSecondTuesday();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:41 PM
Hi Jry,
Try below code to get first monday of every month:
function checkmonday() {
var gdt = new GlideDateTime();
var day = gdt.getDayOfWeek();
var result = false;
if (day == 1 && gdt.getDayOfMonth()<=7){
result = true;
}
return result;
}
checkmonday();
Refer this link below, it might help you to solve it out:
If my answer helped you in any way, mark answer as helpful and correct.
Thanks and regards,
Megha.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:38 PM
Hi,
The isFirstDayOfWeek method simply tells you if it is a Monday or not.
Check below link
Kindly mark it correct and helpful if it solves your issue.
Thanks,
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 09:41 PM
Hi Jry,
Try below code to get first monday of every month:
function checkmonday() {
var gdt = new GlideDateTime();
var day = gdt.getDayOfWeek();
var result = false;
if (day == 1 && gdt.getDayOfMonth()<=7){
result = true;
}
return result;
}
checkmonday();
Refer this link below, it might help you to solve it out:
If my answer helped you in any way, mark answer as helpful and correct.
Thanks and regards,
Megha.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 03:00 AM
Hi Megha,
I was trying the mentioned code to get the first Monday of every month, but it is not working for the scheduled ticket. Can you please help me with how to get the first Monday of every month for the planned maintenance (auto ticket)?
Thanks & Regards,
Abyson

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2023 03:09 AM
Hi Megha,
I was trying the mentioned code to get the first Monday of every month, but it is not working for the scheduled ticket. Can you please help me with how to get the first Monday of every month for the planned maintenance (auto ticket)?
Thanks & Regards,
Abyson