Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

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);
}