How to set the scheduled job to run from Monady to Friday.

mastan babu ko1
Tera Contributor

how to set the scheduled job to run from monaday to Friday only weekdays and also other job to run only on weekends SAT and SUN.

 

Can any one please?

 

3 REPLIES 3

piyushsain
Tera Guru
Tera Guru

Hi use in the condition script

answer = checkCondition();

function checkCondition(){

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

	// Monday is 1 and there onwards
	if(dayOfWeek == 1 || dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5)
		return true;
	else
		return false;	
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

Hi Piyushsain,

Thank you for providing the conditional script. It worked for me on the scheduled jobs and Flow.

 

 

yaswanthi2
Giga Sage

Hi @mastan babu ko1 

Check the conditional field and add following script

 

 

var result = true;

var gdt = new GlideDateTime();

var day  = gdt.getDayOfWeekLocalTime(); //The day of week value from 1 to 7. Monday equals 1, Sunday equals 7.

if(day==6||day==7){

result =false;
} result ;