We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

addEncodedQuery using copy query not picking correct records

vinitha3
Tera Guru

var qry ="stateNOTIN3,6,7,10";

qry += "^business_service=44fb09b16fa96a00e40e0f1aea3ee42c";

qry += "^sys_created_onBETWEEN";

qry += "javascript:gs.dateGenerate('2016-09-01','00:00:00')";

qry += "@javascript:gs.dateGenerate('2016-12-31','23:59:59')";

qry+= "^sys_updated_onRELATIVELE@dayofweek@ago@14";

var gr = new GlideRecord('incident');

gr.addEncodedQuery(qry);

gr.query();

Whats wrong in this script?

Bu URL it works fine but when I Glide Record, it does not work.

1 ACCEPTED SOLUTION

chirag_bagdai
ServiceNow Employee

Hi Vinitha, I think the issue is with "NOTIN" vs "NOT IN". Please give a space in "NOTIN" query and see if that works. Regards, Chirag Bagdai


View solution in original post

5 REPLIES 5

reginabautista
Kilo Sage

I concur with Chirag,NOT IN should be two words..also business service should be a field name such as below:



stateNOT IN3,7^sys_created_onBETWEENjavascript:gs.dateGenerate('2016-09-01','00:00:00')@javascript:gs.dateGenerate('2016-12-31','23:59:59')^sys_updated_onRELATIVELE@dayofweek@ago@14^u_service_affected=24eb74132d93d400a6f73100202fabd3