How to schedule a report to run at 3 times in a day (9 , 12 and 16) from Monday to Friday only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 10:23 PM
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.
- Labels:
-
Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2017 04:27 AM
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;
}
Please do let me know if it works for you
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2017 11:36 PM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2017 01:40 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 12:22 AM
Hi,
Looks like " if(time == "9" || time == "12" || time == "16")" not working, instead it is sending mail from repeat interval time