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.

Filter condition

Rosy14
Kilo Sage

How to get list of records where end date is not more than 14 days from current date?

9 REPLIES 9

Anurag Tripathi
Mega Patron
Mega Patron

Here is a sample script for change request, you can change the table/field names as needed.

var records = new GlideRecord('change_request');
records.addEncodedQuery('end_dateRELATIVELT@dayofweek@ahead@14^end_date>=javascript:gs.beginningOfToday()');
records.query();
while (records.next()) {
	//records.getValue('number'));
//do whatever
}
-Anurag

Hi,

Can you show me the condition in filter of the list.

Something like this, 

AnuragTripathi_0-1709043238321.png

 

 

You can always modify the filter to get the result you need.

-Anurag

is this thread answered @Rosy14 

-Anurag