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 http://wiki.servicenow.com/index.php?title=GlideSystem#getProperty.28String.2C_Object.29. You then have something like:
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 http://wiki.servicenow.com/index.php?title=Adding_a_Property.
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.
To access the property, you find the gs.getProperty() call at http://wiki.servicenow.com/index.php?title=GlideSystem#getProperty.28String.2C_Object.29. You then have something like:
var isValue = gs.getProperty("some.true-false.property");What's the bug in the code?
if (isValue) {
gs.log("is true");
} else {
gs.log("is false");
}
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 http://wiki.servicenow.com/index.php?title=Adding_a_Property.
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:
Post a Comment