GlideRecord query on non-existent column returns all table rows

gmbroth
Kilo Contributor

Hi,

Here's a snippet of Eureka server-side JavaScript:

var gr = new GlideRecord('sysapproval_approver');

gr.addQuery('fred', 'abcd');

gr.query();

As 'fred' is obviously not a valid column name I'd expect either zero rows in the result set and/or an exception but instead get all rows in my table. Is this the correct behavior? I did come across a fix (PRB080092) that mentions handling a non-existent column by throwing an error. What am I missing here?

Thanks, Garry

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Garry Brother



Update : You have to add the below property in the table(sys_properties) with value set to true and type as "True/false".


glide.invalid_query.returns_no_rows=true


NOTE: This is fixed on Fuji Patch2.



Please mark the answer as correct if this resolves your issue.


View solution in original post

5 REPLIES 5

manikorada
ServiceNow Employee
ServiceNow Employee

Garry,



This is a known issue which is fixed in Fuji. You can check from ServiceNow KB: PRB618449: GlideRecord.addQuery(name, undefined) causes severe performance degradatio...


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Mani kanta Korada



Can you please confirm if this is fixed on Fuji. I have tried on latest Fuji Patch 3 and it still doesn't work.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Garry Brother



Update : You have to add the below property in the table(sys_properties) with value set to true and type as "True/false".


glide.invalid_query.returns_no_rows=true


NOTE: This is fixed on Fuji Patch2.



Please mark the answer as correct if this resolves your issue.


Hi Pradeep,



Yes, adding the property and setting it true in Eureka does the trick: no rows are returned from an invalid query; thanks for the quick response!



I intend to upgrade my Eureka to latest Fuji soon and wonder about the behavior on Fuji: will an invalid query simply return no rows or is an exception thrown? Does this property exist on Fuji? If set to false, what happens on an invalid query?



Garry