If we want run scheduled job at Monday and Friday only then can we do in one schedule job if no then what will we do?

Rajani Wadekar
Tera Contributor

If we want run scheduled job at Monday and Friday only then can we do in one schedule job if no then what will we do?

4 REPLIES 4

Chandu Telu
Tera Guru
Tera Guru

Hi Rajini,

 

Check the below option in schedule so you can add only Monday and Friday to run the Job

  • Periodically: Runs on a designated repeating interval

 

Thanks

Chandu Telu

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Only 1 scheduled job is enough

You can make it run daily and check if today is Monday or Friday in the condition field and if it evaluates as True then the script would run

answer = checkCondition();

function checkCondition(){

	var gdt = new GlideDateTime();
	var dayOfWeek = gdt.getDayOfWeekLocalTime();

	// Monday is 1 and there onwards
	if(dayOfWeek == 1 || dayOfWeek == 5)
		return true;
	else
		return false;	
}

find_real_file.png

Regards
Ankur

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

@Rajani Wadekar 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

Hi @Ankur Bawiskar!

Can we run one scheduled job at 2 am from Monday to Friday and at 8 am on Saturday and Sunday?

If yes, how should I do that.

Thank you