How to apply "field is not empty" in GlideRecord addCondition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2020 09:08 PM
Hi all,
I want to seach a non-empty String field in a table by using addCondition.
I went through the following tutorial:
https://developer.servicenow.com/dev.do#!/reference/api/orlando/server_legacy/c_GlideQueryConditionAPI
But looks like xx != "" is not working. Anyone could help?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2020 02:48 AM
Glad that my response helped.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
If not, please let us know if you need some more assistance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2020 09:51 PM
Hi,
Any update on this?
If this has resolved kindly mark appropriate response as correct and close the thread, So others will refer same in future.
Thanks,
Dhananjay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2020 03:00 AM
Hello User,
Along with the above suggestion, below will also work.
var grchange = new GlideRecord('change_request');
grchange.addQuery('state',3);
grchange.addQuery('short_description','');
if(grchange.next())
{
gs.addInfoMessege('Found');
}
Please Mark it helpful/correct if my answer helps in any way to resolve your query.
Reach out to me if any more help required.
Regards
Yash.K.Agrawal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 08:16 PM
I have given some test.
Actually, my requirement is "addCondition" used for "addJoinQuery", not a normal query.
The following worked for filtering non-empty value for field "aaa".
gr.addCondition("aaa", "!=", "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 11:04 PM
Glad to know.
if you think there is any response that helps you please mark that helpful & correct so that this thread can be closed. Happy Coding!
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader