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.

Encoded query filter

rm2
Kilo Contributor

Can someone show me how to filter records in contract table (ast_contract)

I want to build a encoded query to run scheduled job for contracts that will expire on 180 days and 365 days

I have the below script for 90th day

var cnt = new GlideRecord("ast_contract");
cnt.addEncodedQuery('endsRELATIVEGT@dayofweek@ahead@89^endsRELATIVELT@dayofweek@ahead@91');
cnt.query();
while (cnt.next()) {
gs.eventQueue('reminder_contract_90_days', cnt, cnt.number);
}

6 REPLIES 6

I gave or condition 179 to 181, pls check if I did right, I dont know why am I seeing ends on 2099-01-xxx

Its supposed to show until 181 days or before that

find_real_file.png

Hi,

You need to use AND, not OR.

Please review my reply above as it was meant to be AND and if there's ever an OR, I call that out.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!