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.

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
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