Schedule a report daily excluding Friday and Saturday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2019 12:45 AM
Hi all
can you please assist if there is a way to Schedule a report daily excluding Friday and Saturday ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2019 01:35 AM
Hi,
You should set up your report to run Daily on the hour you need. Then mark the Condition checkbox. In the script field, you need to write code that will check if the day is Friday or Saturday. The script will run each time when the scheduled time will meet. The last line of the script must evaluate to true or false (not only return it). Also, the script will not be checked if you will try to for execution, it is only evaluated when the schedule is met.
This is a script condition:
function checkDay(){
var run = true; // set up varaiable to true so that it will run by default
var gdToday = new GlideDateTime(); // get current date
var day = gdToday.getDayOfWeekUTC(); // get the week day numeric value
// check if Friday or Saturday
if(day == 5 || day == 6) {
gs.info('Scheduled Report Run: omitted becouse of Friday/Saturday.'); // write to log about omit
run = false; // change run to false
}
return run; // return decision
}
checkDay(); // run the funtion, it will evaluate to true or false
This is how the schedule should look like:
If my answer helped you in any way, please then mark it as helpful. If this solved your case please mark it as a correct answer. Thank You.
Best regards,
Łukasz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2019 01:36 AM