
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 04:45 AM
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var bcc = new GlideRecord('u_bcp_site_departments');
bcc.addQuery('sillyWilly', gs.getUserID());
bcc.query();
</g:evaluate>
<g:evaluate>
var erc = new GlideRecord('u_bcp_site_departments');
erc.addQuery('fooBar', gs.getUserID());
erc.query();
</g:evaluate>
<j:if test="${bcc.next()}">
<p>TEST 1</p>
</j:if>
<j:if test="${erc.next()}">
<p>TEST 2</p>
</j:if>
</j:jelly>
Odd... I'm seeing both TEST 1 and TEST 2.
I must be missing something simple here. These should both fail the "<j:if>" test.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 05:05 AM
You can add this property 'glide.invalid_query.returns_no_rows' so that the invalid column name query will start returning no rows.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 06:04 AM
I added the following to the sys_properties table:
Now... if I set this to "true", it works. But when I leave it to false but then use gs.getSession().setStrictQuery(true); in my jelly glideRecord query, it doesn't work. I've logged out and back in, cleared cache, and even reboot the computer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 06:40 AM
I *may* have it figured out...
If I set the glide.invalid_query.returns_no_rows value on the sys_properties table to "true", "true" is actually acting like "active". So, here are my results:
#1
// The sys_properties value to "true"
<g:evaluate>
gs.getSession().setStrictQuery(true);
var erc = new GlideRecord('u_bcp_site_departments');
erc.addQuery('fooBar', gs.getUserID());
erc.query();
</g:evaluate>
The above code will NOT return any records.. which is perfect.
#2
// The sys_properties value is at "true"
<g:evaluate>
var erc = new GlideRecord('u_bcp_site_departments');
erc.addQuery('fooBar', gs.getUserID());
erc.query();
</g:evaluate>
The above code WILL show all records, even though sys_properties value is "true"
#3
// The sys_properties value is at "true"
<g:evaluate>
gs.getSession().setStrictQuery(false);
var erc = new GlideRecord('u_bcp_site_departments');
erc.addQuery('fooBar', gs.getUserID());
erc.query();
</g:evaluate>
The above code does in fact show all records.
Conclusion: So I'm still a bit stumped. I'm just going to cough it up to a glitch/bug in ServiceNow, and leave the sys_properties value set to "true", and manually override it to false where needed by using: gs.getSession().setStrictQuery(false);
I'd like to default sys_properties to false and manually override when needed to true, but alas, it's broke.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 08:20 AM
You should open a ticket with HI. Maybe they (being ServiceNow) are unaware and should be informed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 10:45 AM
Let me try these things out... Will update the thread back.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 11:05 AM
I am not a jelly expert but I added a macro to a catalog and checked this.
Macro
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_sysID" jelly="true">
var inc = new GlideRecord('incident');
inc.addQuery('sys_idd','12232');
inc.query();
var total=inc.getRowCount();
total;
</g:evaluate>
$[jvar_sysID]
</j:jelly>
So I kept changing the property between true and false, but I got the correct result every time. Am I doing something wrong?