addEncodedQuery Method In Lower Case Results are Strange instead of Error

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 10:41 PM
Hi All
in one my script i used below and results are as expected.
var incGr = new GlideRecord('incident');
var cn=0;
incGr.addEncodedQuery('active=true^reassignment_count>2');
Now i did this and it is returning all incidents instead of throwing syntax error.
var incGr = new GlideRecord('incident');
var cn=0;
incGr.addencodedquery('active=true^reassignment_count>2');
why i tested this in some of the env my junior developers used lower case method name resulting into more records fetched and it updated more no of records causing issue.
I tested both versions above and behavior with lowercase is really Strange.
Am i missing something here . Please put some light on this .
Regards
RP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2024 04:34 AM
The second method is invalid, so it is ignored. Anything in a GlideRecord that cannot be interpreted is ignored, so the query, in this case, results in returning all records. It's not a syntax error, rather you are calling a method that does not exist. Same if your query contained an error like omitting the ^ or mistyping a field name.