nil() and (empty) fields

Cris6
Kilo Expert

Just a quick (hopefully) trivial question.

I have a field on a table, the field has the word '(empty)' in it, so it is not literally empty, but instead states that it is (empty).

I have a script using the nil() GlideElement.

What I want to know, will nill() return false on this field? Because there is the string (empty) in there? Or does (empty) literally mean empty, therefore nill() will be true?

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

is it reference field or string type field? 

if reference type field then it will be empty and nil() will be true. if its string type field then it is actually a string there so it will not give true. 

 

View solution in original post

5 REPLIES 5

Harsh Vardhan
Giga Patron

is it reference field or string type field? 

if reference type field then it will be empty and nil() will be true. if its string type field then it is actually a string there so it will not give true. 

 

Hi Harshvardhan, yes it is a reference field! So (empty) does mean empty and nil() is true. Great. Thanks for the answer

then nil() will be true here .

 

if my answer helped you, kindly mark my answer as correct and close this thread. 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

that field holds a string value as 'empty' so it means it has some value and is not empty

so if that is string type then it is not nil

Mark āœ… Correct if this solves your issue and also mark šŸ‘ Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader