The CreatorCon Call for Content is officially open! Get started here.

Schedule Job for 3rd Thursday of Every Month

Community Alums
Not applicable

Hi All,

Can someone please advise on the conditional code for running a scheduled job for every 3rd Thursday of the month?

I can find examples online but I am not sure what to change in the code to match my requirement.

Many thanks,

Alex

 

1 ACCEPTED SOLUTION

Elijah Aromola
Mega Sage

Try the following:

var gdt = new GlideDateTime().getDate();
var day = gdt.getDayOfMonth();
var week = gdt.getDayOfWeek();

if(day == 4 && week == 3) {
    //3rd thursday of month
}



View solution in original post

8 REPLIES 8

Community Alums
Not applicable

Hello again,

I would remove the script from the 'Run this script' section and test.

That's the only difference between my one and yours so hopefully works!

Thanks,
Alex

Tried removing script form 'Run this script" section still not working request is created daily.

SMH!!!

 

Thanks

Did you ever find a solution to this? I am having a similar issue where I try to run it daily with a condition to check if the day is the 1st Tuesday of each month, yet the record is created daily.

Nitesh Balusu
Giga Guru

It checks to see if it is a Thursday (new Date().getDay() == 4) and if it is greater than or equal to 14 days into the month and less than or equal to 21 days. That's where the 3rd Thursday falls in the month (new Date().getDate() >=14 && new Date().getDate() <=21).

 

if( (new Date().getDay() == 4) && (new Date().getDate() >=14 && new Date().getDate() <=21) )