Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Create Report with Dynamic Filter Dates

LuLe Game
Tera Expert

Hello Community, I need your help with the following: 

I want to create a report that will help me filter the change request records in a current (specific) week. For example in Change Request, I want the records with Planned Start Date from Wednesday to Tuesday of this week, that would be from November 16th to 22nd. But the following week if I went to see this report I would be seeing the records with the Planned Start Date of November 23rd to 30th. Can anyone help how I can achieve this with the conditions or script needed for a report? Thanks in advance

1 ACCEPTED SOLUTION

Mike_R
Kilo Patron
Kilo Patron

Try this

instanceName.service-now.com/change_request_list.do?sysparm_query=start_dateDATEPARTWednesday%40javascript%3Ags.datePart('dayofweek'%2C'wednesday'%2C'GE')%5Estart_dateONThis%20week%40javascript%3Ags.beginningOfThisWeek()%40javascript%3Ags.endOfThisWeek()%5ENQstart_dateDATEPARTTuesday%40javascript%3Ags.datePart('dayofweek'%2C'tuesday'%2C'LE')%5Estart_dateONNext%20week%40javascript%3Ags.beginningOfNextWeek()%40javascript%3Ags.endOfNextWeek()&sysparm_view=

 

Mike_R_0-1668874439676.png

 

View solution in original post

3 REPLIES 3

SUBHAM AGARWAL
Tera Guru

Hello,

Have you tried adding conditions like this screenshot?

Thanks

Mike_R
Kilo Patron
Kilo Patron

Try this

instanceName.service-now.com/change_request_list.do?sysparm_query=start_dateDATEPARTWednesday%40javascript%3Ags.datePart('dayofweek'%2C'wednesday'%2C'GE')%5Estart_dateONThis%20week%40javascript%3Ags.beginningOfThisWeek()%40javascript%3Ags.endOfThisWeek()%5ENQstart_dateDATEPARTTuesday%40javascript%3Ags.datePart('dayofweek'%2C'tuesday'%2C'LE')%5Estart_dateONNext%20week%40javascript%3Ags.beginningOfNextWeek()%40javascript%3Ags.endOfNextWeek()&sysparm_view=

 

Mike_R_0-1668874439676.png

 

Where would I be in this world without your advice? I did a small change from your screenshot (below). 

Thanks

 

LuisArmando_0-1668868787784.png