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

Alikutty A
Tera Sage

Hi Teja,



You need to setup a periodic scheduled job with script to control the schedule, Please try this out.



var d = new GlideDateTime();


var dt = d.getTime().toString().split(" ")[1];


var time = dt.split(":")[0];   //Gets Hours


if(d.getDayOfWeekUTC() == 6 || d.getDayOfWeekUTC() == 7){


  return false;   //Skip on Sat and Sunday


}else if(time == "9" || time == "12" || time == "16"){


  return true;


}else{


  return false;


}



find_real_file.png



Please do let me know if it works for you



Thank You


Please Hit Like, Helpful or Correct depending on the impact of response


Below error message is displayed while trying to save the report, no changes done to the script.



Could not save record because of a compile error: JavaScript parse error at line (5) column (9) problem = invalid return (<refname>; line 5)


Please try this once



var d = new GlideDateTime();


var dt = d.getTime().toString().split(" ")[1];


var time = dt.split(":")[0];   //Gets Hours


if(d.getDayOfWeekUTC() == 6 || d.getDayOfWeekUTC() == 7){


  answer = false;   //Skip on Sat and Sunday


}else if(time == "9" || time == "12" || time == "16"){


  answer = true;


}else{


  answer = false;


}



Thank You


Please Hit Like, Helpful or Correct depending on the impact of response


Hi,

Looks like " if(time == "9" || time == "12" || time == "16")" not working, instead it is sending mail from repeat interval time