- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2020 01:49 AM
Hi,
I have a requirement where i need to send a notification as a reminder on last week of every quarter.
Example:
March 23 of 2020 for Q1
June 22 of 2020 for Q2 and so on.
Can anyone please help me out how to acheive this ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2020 02:17 AM
Hi Irfan,
You can create a schedule job that Runs as below with script.
executeonLastWeek();
function executeonLastWeek() {
//gives you current date time
var getdtime = new GlideDateTime();
//gives you current month number 1-Jan, 2-Feb, so-on
var getmonth = getdtime.getMonth();
//execute only if it is start of quarter
if (getmonth == '3' || getmonth == '6' || getmonth == '9' || getmonth == '12') {
//gets you number of days in month 30 or 31 or 29
var days_in_month = getdtime.getDaysInMonthUTC();
//gets you today's date
var day_of_month = getdtime.getDayOfMonthUTC();
if (day_of_month >= days_in_month - 6) {
//return true;
//your script here to set reminder gs.eventQueue();
} else {
// return false;
//do nothing
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2020 02:13 AM
Answer by Aman Reddy Gurram in the following thread offers an answer. He's creating a "System Definition" -> "Scheduled Jobs" and checking "Conditional".

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2020 02:17 AM
Hi Irfan,
You can create a schedule job that Runs as below with script.
executeonLastWeek();
function executeonLastWeek() {
//gives you current date time
var getdtime = new GlideDateTime();
//gives you current month number 1-Jan, 2-Feb, so-on
var getmonth = getdtime.getMonth();
//execute only if it is start of quarter
if (getmonth == '3' || getmonth == '6' || getmonth == '9' || getmonth == '12') {
//gets you number of days in month 30 or 31 or 29
var days_in_month = getdtime.getDaysInMonthUTC();
//gets you today's date
var day_of_month = getdtime.getDayOfMonthUTC();
if (day_of_month >= days_in_month - 6) {
//return true;
//your script here to set reminder gs.eventQueue();
} else {
// return false;
//do nothing
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2020 02:33 AM
It's probably better to check on "Conditional" and write the execution time login in the "Condition" script rather than write it in "Run the Script" area.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2020 02:43 AM
That is just an example & suggestion. Can be tailored in a way that fits best as per your need.