How to schedule a report to run at 3 times in a day (9 , 12 and 16) from Monday to Friday only

tejapolaki
Kilo Contributor

We have requirement to schedule report to run at different time intervals in a day ( not uniform) during weekdays , is there a way it can be done to schedule report with the above requirements.

Thanks.

13 REPLIES 13

Rajesh Annepak1
Kilo Guru

Hello Teja,



Please check this , It might be helpful



How to set repeat interval for scheduled job based on condition?




Please mark Helpful if the article is useful for your query



Rajesh


Brian Lancaster
Tera Sage

Did you get an answer that worked for you.  I'm need to do the same thing but only two times a day at 8 and 5.

Brian Lancaster
Tera Sage

I got this working for me with the below code.

answer = ifScript();
function ifScript(){
	var d = new GlideDateTime(); //setup date time object
	d.setValue(gs.nowDateTime()); //set to current date/time
	var dt = d.getTime().toString().split(" ")[1];
	var time = dt.split(":")[0];   //Gets Hours
	if(d.getDayOfWeekUTC() != 6 && d.getDayOfWeekUTC() != 7){ //Keep from running on Saturday and Sunday.
		if(time == "08" || time == "17"){ //run at 8 AM and 5 PM
			return true;
		}
		else{
			return false;
		}
	}
}

Had to modify the code slightly.  Need to use 08 instead 8 for 8 am since ServiceNow uses military time.

Hi Brian,

 

if we use the timings as 4:30 AM and 12:45 than what can we put.

 

Thanks in Advance.

Is that 12 AM or PM?