- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2022 10:55 PM
For referencefields, reference qual are used,Records that do not meet the conditions cannot be selected on the UI
But use glideRecord.setValue(record'sys_id);
The record does not meet the filtering conditions,But his value is still normally set
I want to judge whether the record meets the filtering conditions before setValue. What should I do
I got this value from reference qual: (javascript: "parent=" + new ......)
Can i use such a script in gliderecord to filter record
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2022 11:08 PM
Hi,
You need to glide same table with reference qualifier condition query.
And check if your sys_id is one of the them.
to do that you have to apply query like below:
var grRec = new GlideRecord('tablename');
grRec.addEncodedQuery('Reference qualifier condition here'); // 'parent=somevalue^active=true'
grRec.addQuery('sys_id',record'sys_id); // this is to check if record is matching reference qualifier
grRec.query();
if(grRec.hasNext()){
glideRecord.setValue(record'sys_id);
}
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2022 11:08 PM
Hi,
You need to glide same table with reference qualifier condition query.
And check if your sys_id is one of the them.
to do that you have to apply query like below:
var grRec = new GlideRecord('tablename');
grRec.addEncodedQuery('Reference qualifier condition here'); // 'parent=somevalue^active=true'
grRec.addQuery('sys_id',record'sys_id); // this is to check if record is matching reference qualifier
grRec.query();
if(grRec.hasNext()){
glideRecord.setValue(record'sys_id);
}
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2022 11:21 PM
Hi,
yes while using GlideRecord it doesn't respect the ref qualifier.
In order to check if the record matches the filter you need to query and check if the query returns any result
you can use GlideFilter to check this
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader