nil() vs isNil() - What's the difference?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2009 07:09 AM
What is the difference between the methods nil() and isNil()? I've seen both used in wiki and forum examples.
Example: Reference Field , http://community.service-now.com/node/1000544
This is where API docs would come in really handy.
- 58,027 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 06:58 AM
And what is funny, in the wiki article: GlideElement - ServiceNow Wiki, they use isnil() in the example code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2015 01:52 AM
Yes, I noticed that too
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 06:42 AM
After reading all of this ... I felt good ... So to look @ ref field to see if htere is a active reference to a record in another table....
i would use ...
current.<some_ref_field>.isNil();
if there is no reference it would = true else false...
..... No joy.... I must be missing something.
I am trying to do this with a field style ...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 06:46 AM
Hi Jason,
Have you tried>
current.ref_field != ""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2020 04:39 AM
The nil() function is now documented here:
https://developer.servicenow.com/dev.do#!/reference/api/orlando/server/no-namespace/c_GlideElementScopedAPI#r_ScopedGlideElementNil
The isNil() function should not be used and does work in scoped applications.