Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

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 ++;

       }

}