Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Automatically additional filters applied in encodedquery

sainath3
Giga Guru

Hi Team,

 

I am observing some strange behavior in the ServiceNow code.

 

Script include code, calling from UI Action:

var name='abc';

var cc=new GlideRecord('core_company');

cc.addEncodedQuery('name='+name);

cc.query();

gs.info("CC query :"+cc.getEncodedQuery());

 

Result for ITIL User:

CC query: name=abc.

Result for Admin

CC query: name=abc^vendor_type=global^ORpublicly_traded=true.

 

 

Note:

From the background script additional filter is not applied.

Same additional filters applied, when I have tried the same code in a separate script include(only this function).

 

Can anyone please explain this, why these additional filters have been applied to the encodedquery?

 

1 REPLY 1

palanikumar
Giga Sage

I think this condition might have got added from a Query business rule. Can you check if there is any query business rule?

Thank you,
Palani