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.

How to filter out change request whose planned end date is exact 5 days ago

Anamika Thakur
Tera Contributor

Hi,

I want to write filter condition to display the change request only whose planned end date was exact 5 days ago. It should not show the change request who planned end date is more that 5 days ago.

How can I achieve this one.

Any help would be appreciated. Thanks in Advance.

1 ACCEPTED SOLUTION

Manmohan K
Tera Sage

Hi @Anamika Thakur ,

 

You can use below code to get the change request whose planned end date was exact 5 days ago

 

 

var chgGr = new GlideRecord("change_request");
chgGr.addEncodedQuery('end_dateRELATIVEGT@dayofweek@ago@5^end_dateRELATIVELT@dayofweek@ago@4'); 
chgGr.query();
while (chgGr.next()) {
    gs.print(chgGr.number);
}

 

 

View solution in original post

2 REPLIES 2

Devender Kumar
Tera Guru

Hi @Anamika Thakur ,

Please refer the below link.

https://www.servicenow.com/community/developer-forum/how-to-retrieve-data-from-two-and-three-days-ag... 

 

If my answer resolves your issue then don't forget to mark it as correct/helpful.

Regards,

Devender

 

Manmohan K
Tera Sage

Hi @Anamika Thakur ,

 

You can use below code to get the change request whose planned end date was exact 5 days ago

 

 

var chgGr = new GlideRecord("change_request");
chgGr.addEncodedQuery('end_dateRELATIVEGT@dayofweek@ago@5^end_dateRELATIVELT@dayofweek@ago@4'); 
chgGr.query();
while (chgGr.next()) {
    gs.print(chgGr.number);
}