What's wrong with isNil()

Bharat23
Kilo Guru

I have encountered scenarios where <variablename>.isNil() is generating an error saying "isNil() is not a function". Today I encountered a scenarios which was weirdest of all....I was working on a catalog workflow (creating from scratch), there were 2 IF activities both copy of each other, isNil() worked in one and threw error in the next block. Has anyone else observed this inconsistent behavior on part of isNil()....anyone able to make any sense as to when and where it will work?

1 REPLY 1

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Bharat,



Here's a thread that talks about it:


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



In my experience, though, using JSUtil.nil() is the best way to go as it's more predictable.


JSUtil - ServiceNow Wiki