We are testing Brooklyn 10.x in a sandbox and have run into a problem that is causing a lot of our pages with custom javascript to fail (which is most of our pages.)
Within the javascript, we query a field on a model and then take action based on that field having a value or not. The fields on the object are strings, and:
if field is null, do Action 1.
if field is not null, do Action 2.
This all worked fine, but now the string fiend off the model is coming through as undefined instead of null or “”. So all our If conditions are failing to execute.
I’ve build a repro page off the contact object using a native string field that is probably null in most cases.
Snippet is simply this:
var params = argumentsu0],
$ = skuid.$;
contactModel = skuid.model.getModel(‘contact’);
contactRow = contactModel.getFirstRow();
var myVar = “”;
// this alert will show null or “”
alert("myvar Value 1 " + myVar);
// this is a null field on the object
myVar = contactModel.getFieldValue(contactRow, ‘JigsawContactId’, true);
// this alert will show undefined
alert("myvar Value 2 " + myVar);
So, question - is this expected behavior and a change we need to address in all of our snippets? I would expect the field to have a null value, not sure why it is showing up as undefined.
Full page repro:
{{Name}}
{{Model.label}}
var params = argumentsv0],
$ = skuid.$;
contactModel = skuid.model.getModel(‘contact’);
contactRow = contactModel.getFirstRow();
var myVar = “”;
alert("myvar Value 1 " + myVar);
// this is a null field
myVar = contactModel.getFieldValue(contactRow, ‘JigsawContactId’, true);
alert("myvar Value 2 " + myVar);