how can we send a Scheduled report excluding weekends?

Shrestha4
Kilo Contributor

I want to send Scheduled Report excluding weekends? 

When we go to scheduled report and and set RUN field as periodically and send report daily, I want to exclude weekends.

How can I achieve this?

 

find_real_file.png

9 REPLIES 9

asifnoor
Kilo Patron

Hi,

You could select daily and inside conditions you can check the day using 

getDayOfWeekLocalTime

and return true only if its weekday.

Mark the comment as a correct answer and helpful if it helps.

Ian Mildon
Tera Guru

The easiest (and quickest) option would be to set the scheduled job to Daily, check the Conditional field and pop this script in the Condition field:

(function() {  
      //run on weekdays only  
      var day = new Date().getDay();  
      return (day != 6 && day != 7);  //not Saturday or Sunday
    })();  

Ashish Dhole2
Kilo Expert

1] go to the left navigation panel and search scheduled reports

2] click on Conditional checkbox and write below script

function sendReport()
{
   var weekEnd=true;
   var now = new GlideDateTime();   
   if(now.getDayOfWeek()>=5)
{
    weekEnd=false;
}
    return weekEnd;
}
    sendReport();

Please, Mark the comment as a correct answer and helpful if it helps.

Thanks,

Regards,

Ashish Dhole

Hi,

I Have Requirment to run the report on 6th business day of every month(excluding weekends and holidays) how can i achieve it .

 

Anyone can please help me on this.

thanks,

Hello, may I ask for help if you could provide a script that sends the report during M-F and during business hours only (e.g. 9AM to 6PM)? I've tried all possible options but it seems like the timezone is messed-up in my script. Thanks in advance!