Brooklyn 10.0.7 JS null field issue

  • 2
  • Problem
  • Updated 1 year ago
  • Acknowledged
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 = arguments[0],
$ = 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:


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="contact" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
            <fields>
                <field id="Id"/>
                <field id="Name"/>
                <field id="JigsawContactId"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <pagetitle model="contact" uniqueid="sk-2_JDEK-150">
            <maintitle>
                <template>{{Name}}</template>
            </maintitle>
            <subtitle>
                <template>{{Model.label}}</template>
            </subtitle>
            <actions>
                <action type="multi" label="Run Snippet" uniqueid="sk-2_JDTU-153">
<actions>
    <action type="custom" snippet="newSnippet"/>
</actions>
</action>
            </actions>
        </pagetitle>
        <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="contact" buttonposition="" uniqueid="sk-2_J4uz-118" mode="readonly">
            <columns>
                <column width="50%">
                    <sections>
                        <section title="Section A" collapsible="no" showheader="false">
                            <fields>
                                <field uniqueid="sk-2_J9uF-130" id="Name" valuehalign="" type=""/>
                                <field uniqueid="sk-2_J9uF-131" id="JigsawContactId" valuehalign="" type=""/>
                            </fields>
                        </section>
                    </sections>
                </column>
                <column width="50%">
                    <sections>
                        <section title="Section B" collapsible="no" showheader="false">
                            <fields/>
                        </section>
                    </sections>
                </column>
            </columns>
        </basicfieldeditor>
    </components>
    <resources>
        <labels/>
        <javascript>
            <jsitem location="inlinesnippet" name="newSnippet" cachelocation="false">var params = arguments[0],
$ = 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);
</jsitem>
        </javascript>
        <css/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb

Posted 1 year ago

  • 2
Photo of Gopal Agrawal

Gopal Agrawal

  • 598 Points 500 badge 2x thumb
Hi Chandra, 

I am also facing the same issue of an undefined model.

Please let me know, if you will get any lead regarding this.

Thanks
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
UPDATE: Skuid dev folks are looking into this.
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,220 Points 5k badge 2x thumb
Hi Chandra,

We have confirmed that our 10.0 release contained changes that include updating values from "null" to "undefined". Prior to these changes, Skuid was returning the value of things as "null" that were in fact "undefined", and this was updated to improve the stability of the product. However, this does mean that you will need to update any code you have that is relying on that value being explicitly null when there is no value. We have updated the releases notes to provide additional information about this change.

Thank you for bringing this to our attention. If you have any further concerns, please let us know.

Karen