- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 07:50 PM
Dear experts,
I have created a scheduled job to trigger the email to be sent out on 1st of June yearly, if I want to make it as to run yearly since it does not have the option. How should I make sure it will trigger on the first of June every year. What I am doing now is periodically with 365 days, but not sure this is the correct approach on this. Please advise.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 09:01 PM
Hi @ChuanYanF ,
if (new GlideDate().getMonth() == 7) {
//write your logic here
}
you can use this
the problem with 365 days is leap year contains 366 days and it won't trigger extactly on july 1st with on a leap year and followup years
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 09:29 PM
you can make it run Monthly on 1st Date
Then use this in the condition field so that it only runs on 1st June and not on any other date
this will handle leap year etc
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 09:01 PM
Hi @ChuanYanF ,
if (new GlideDate().getMonth() == 7) {
//write your logic here
}
you can use this
the problem with 365 days is leap year contains 366 days and it won't trigger extactly on july 1st with on a leap year and followup years
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 09:29 PM
you can make it run Monthly on 1st Date
Then use this in the condition field so that it only runs on 1st June and not on any other date
this will handle leap year etc
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 09:53 PM
Hello @ChuanYanF ,
You can use/explore GlideDateTime api. You can follow the steps given below:
var gdt= new GlideDateTime();
var currentMonth = gdt.getMonthUTC();//Similarly you can take year,weekend etc.
//Make sure currentMonth is either string or integer and then compare in the if loop
//to check the type you can log gs.log('Current month type:'+typeof currentMonth);
if(currentMonth ==7){
//You logic part whatever you want to implement you can do here.
}
Please mark my response as helpful if it resolved your doubt.
Thank you,
Mahesh.