Sunday, December 08, 2013

ServiceNow - when the "true|false" type isn't

Let's say you have a system property defined in ServiceNow with a type of "true | false".

To access the property, you find the gs.getProperty() call at  You then have something like:
var isValue = gs.getProperty("");

if (isValue) {
  gs.log("is true");
} else {
  gs.log("is false");
What's the bug in the code?
gs.log(typeof isValue)
returns "string".

gs.getProperty() will always return a string value.  Instead of it being documented at the link above, you can see this in the table dictionary definition and it is documented at

Maybe I'm just old but I really don't like dynamically typed languages, especially when you have almost no debugging environment to speak of.

No comments: