
- 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 05:23 AM
Interesting, this property only works with addQuery(). It does not work with get(), which makes sense, but I thought I'd point it out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 01:57 PM
Does it work with addEncodedQuery?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 04:14 PM
The property does work with addEncodedQuery().
So yes to addQuery() and addEncodedQuery(), but no to get().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 05:04 AM
I am guessing that fooBar and sillyWilly are not, in fact, fields on the form. I tried with incident and fake fields:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
var bcc = new GlideRecord('incident');
bcc.get('u_frdea', gs.getUserID());
gs.log(bcc.sys_id, '$$$$ - bcc');
</g:evaluate>
<g:evaluate>
var erc = new GlideRecord('incident');
erc.get('u_hakldj', gs.getUserID());
gs.log(erc.sys_id, '$$$$ - erc');
</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>
It returns the sys_id of the first incident in the list. This leads me to believe that if you populate an addQuery with a false field, the GlideRecord query will ignore that condition.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2015 05:10 AM
Your last sentence hits the nail on the head. This is true, but ServiceNow should not allow this.