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

Chuck Tomasi
Tera Patron

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.

11 REPLIES 11

And what is funny, in the wiki article: GlideElement - ServiceNow Wiki, they use isnil() in the example code.


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 ...


Hi Jason,



Have you tried>



current.ref_field != ""


lasse3
Mega Guru

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.