Need to run a scheduled job on every 2nd Monday in every month.

Mallika4
Tera Contributor

Hello Developers!

I am trying to run a scheduled job for every 2nd Monday in every month.

Can anyone help me on that?

Thanks in advance!

8 REPLIES 8

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you will have to make it trigger daily

then in the condition script check if it is 2nd Monday of month

refer these and enhance as per your requirement

job for Third Tuesday of each month

First Monday of Every Month

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Steps

1) Conditional checkbox true

2) Condition script below

3) Daily

answer = checkCondition();

function checkCondition(){

	var gdt = new GlideDateTime();
	if((gdt.getDayOfMonthLocalTime() >= 8 && gdt.getDayOfMonthLocalTime() <= 14) && (gdt.getDayOfWeekLocalTime() == 1)) {
		return true;
	}
	else{
		return false;
	}

}

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

I have template on sc_task table, need to generate that template on scheduled job on every 2nd monday.

Is that possible?

Thanks in advance!

Hi,

you can create task based on template

How to apply a standard change task template via script / workflow

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader