Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Siva Sandilya V
ServiceNow Employee

Below code is helpful in providing list of weekday dates and can be used in dynamic filters

var num = 7;

var dateList = [];

for(var i=0;i<num ;i++){

      var date = new GlideDate();

      date.setValue(((''+gs.daysAgo(i+1)).split(" "))[0]);

      var day = date.getByFormat('EEEE');

      if(day != "Saturday" && day != "Sunday"){

           dateList.push(date.getValue());

       }else{

           num ++;

       }

}