- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 12:34 PM
HI SN folks,
I've posted this in developer community because from what I can tell this will take a script one way or another.
I need to create either a scheduled job or a Flow Designer trigger that executes an incident record creation on the last Friday of every month at 7am.
In both the scheduled job builder and in Flow Designer, it appears I can target a date of the month or a day of the week, but not something as dynamic as the last Friday of the month. The scheduled job builder allows for the "Conditional" check-box, which then accepts a glide script (I think).
Any help from here would be greatly appreciated.
Thanks!
--Robert
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 12:38 PM
Please check the below thread has the same requirement as you
https://community.servicenow.com/community?id=community_question&sys_id=5cfd4368db79f3801cd8a345ca961916
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 12:38 PM
Please check the below thread has the same requirement as you
https://community.servicenow.com/community?id=community_question&sys_id=5cfd4368db79f3801cd8a345ca961916
Please mark answer correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2022 01:28 PM
Basing on the other reply
function isFridayOfLastWeekOfMonth() {
var report_date = new GlideDateTime();
var day_in_week = report_date.getDayOfWeekUTC();
//gs.print(day_in_week); //1-Monday
var days_in_month = report_date.getDaysInMonthUTC();
//gs.print(days_in_month);
var day_of_month = report_date.getDayOfMonthUTC();
//gs.print(day_of_month);
if (day_of_month >= days_in_month - 6) {
if (day_in_week == 5) {
//It's Friday of last week of the month.
return true;
} else {
return false;
}
} else {
return false;
}
}
isFridayOfLastWeekOfMonth();
Vinod Kumar Kachineni
Community Rising Star 2022