Models set to "Create Default Row If Model Has None" and "Clone Always" throw console error if now rows since upgrading to Brooklyn

  • 1
  • Problem
  • Updated 2 years ago
  • In Progress
Merged

This conversation has been merged. Please reference the main conversation: Brooklyn Errors on Clone Always model save with no rows on page load

I have been using some models that I want to create a new record if there are no records, but clone the existing record if there is one. This lets you present the current record info to the user as a clone, allow them to update it and save it, but still have the original record so  you can create a version history. Since upgrading from 8 to 9.5.5, I now get a console error if the model has no rows on page load. It used to just create a new row. It would be great to have this functionality back.
(I reported this last week, but wanted to explain the problem more concisely)
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Thank you for explaining it in more precise manners. 

If you wouldn't mind, could you post the page's XML for us? Since it has to do with upgrading, it might be something that has carried over in the XML.

Furthermore, is this the kind of thing where if you make a new page with the same set up, it'll work? Or is it broken in all instances?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Sure. I cloned my page and removed most of the components and models so that it was easier to sort through. If, on page load, the model loads no rows due to conditions restricting the rows to just those that belong to a specific contact, then upon model save attempt, you will get the following console error and the model will not save. If upon page load, the model has a row, then the model will save correctly with no console error.


skuid__SkuidJS:8 Uncaught TypeError: Cannot read property 'row' of undefined at Object.<anonymous> (skuid__SkuidJS:8) at Function.each (skuid__JQueryJS:2) at W.<anonymous> (skuid__SkuidJS:8) at Function.each (skuid__JQueryJS:2) at Object.K [as save] (skuid__SkuidJS:8) at save (skuid__SkuidJS:18) at Object.h.runActionNode (skuid__SkuidJS:18) at m (skuid__SkuidJS:18) at Object.h.runActionsNode (skuid__SkuidJS:18) at HTMLDivElement.<anonymous> (core.js:3)

Here is the XML

<!--
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" showheader="false" theme="StoneHouseModernDashboard">
    <models>
        <model id="IPScontact" limit="1" query="true" createrowifnonefound="false" type="" sobject="Contact" datasource="salesforce">
            <fields>
                <field id="Id"/>
                <field id="Name"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
            </conditions>
            <actions/>
        </model>
        <model id="Policy" limit="1" query="true" createrowifnonefound="true" type="" sobject="Investment_Policy__c" doclone="yes" orderby="CreatedDate DESC" datasource="salesforce">
            <fields>
                <field id="Contact__c"/>
                <field id="Contact__r.Name"/>
                <field id="CreatedBy.Name"/>
                <field id="CreatedDate"/>
                <field id="IsDeleted"/>
                <field id="Name"/>
                <field id="LastModifiedById"/>
                <field id="LastModifiedBy.Name"/>
                <field id="LastModifiedDate"/>
                <field id="LastReferencedDate"/>
                <field id="Id"/>
                <field id="SystemModstamp"/>
                <field id="CreateDateShort__c"/>
                <field id="Age__c"/>
            </fields>
            <conditions>
                <condition type="param" value="id" field="Contact__r.Id" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
            </conditions>
            <actions>
                <action>
                    <actions>
                        <action type="updateRow" fieldmodel="InvestmentPolicy" field="Contact__c" enclosevalueinquotes="true" value="{{$Model.IPScontact.data.0.Id}}"/>
                        <action type="updateRow" fieldmodel="IPScontact" field="Contact__c" enclosevalueinquotes="true" value="{{$Model.IPScontact.data.0.Name}}"/>
                    </actions>
                    <events>
                        <event>models.loaded</event>
                        <event>row.created</event>
                    </events>
                </action>
            </actions>
        </model>
    </models>
    <components>
        <wrapper uniqueid="sk-gvhBS-426">
            <components>
                <wrapper uniqueid="sk-10pPk9-2716">
                    <components>
                        <richtext multiple="false" uniqueid="sk-10p4dB-2689" model="Policy">
                            <contents>&lt;p style="text-align: center;"&gt;&lt;span style="font-size:26px;"&gt;&lt;b style="color: rgb(105, 105, 105); font-family: georgia, serif; font-size: x-large; text-align: center;"&gt;&lt;i&gt;Policy For&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;b style="background-color: initial; color: rgb(105, 105, 105); font-family: georgia, serif; font-size: x-large;"&gt;&lt;i&gt;{{Contact__c}}&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
</contents>
                        </richtext>
                    </components>
                    <styles>
                        <styleitem type="background" bgtype="color">
                            <styles>
                                <styleitem property="background-color" value="white"/>
                            </styles>
                        </styleitem>
                        <styleitem type="border" borders="none" padding="all">
                            <styles>
                                <styleitem property="padding" value="5px"/>
                                <styleitem property="box-sizing" value="border-box"/>
                            </styles>
                        </styleitem>
                        <styleitem type="size" height="custom"/>
                    </styles>
                </wrapper>
                <wrapper uniqueid="sk-10pmbf-2753">
                    <components/>
                    <styles>
                        <styleitem type="background"/>
                        <styleitem type="border"/>
                        <styleitem type="size" height="custom">
                            <styles>
                                <styleitem property="min-height" value="10px"/>
                                <styleitem property="max-height" value="10px"/>
                                <styleitem property="overflow-y" value="auto"/>
                            </styles>
                        </styleitem>
                    </styles>
                </wrapper>
                <wrapper uniqueid="sk-10p_dc-2766">
                    <components>
                        <wrapper uniqueid="sk-hSu_l-454">
                            <components>
                                <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Policy" buttonposition="" uniqueid="sk-gr-jw-303" mode="edit" layout="above">
                                    <columns>
                                        <column width="100%">
                                            <sections>
                                                <section title="Section A" collapsible="no" showheader="false">
                                                    <fields>
                                                        <field id="Age__c" showhelp="true" valuehalign="" type=""/>
                                                    </fields>
                                                </section>
                                            </sections>
                                        </column>
                                    </columns>
                                </basicfieldeditor>
                            </components>
                            <styles>
                                <styleitem type="background" bgtype="color">
                                    <styles>
                                        <styleitem property="background-color" value="white"/>
                                    </styles>
                                </styleitem>
                                <styleitem type="border"/>
                                <styleitem type="size" height="custom" width="custom">
                                    <styles>
                                        <styleitem property="min-width" value="600px"/>
                                        <styleitem property="min-height" value="100%"/>
                                    </styles>
                                </styleitem>
                            </styles>
                        </wrapper>
                    </components>
                    <styles>
                        <styleitem type="background"/>
                        <styleitem type="border" padding="all" borders="all">
                            <styles>
                                <styleitem property="border" value="2px solid #7f7f7f"/>
                                <styleitem property="padding" value="10px"/>
                                <styleitem property="box-sizing" value="border-box"/>
                            </styles>
                        </styleitem>
                        <styleitem type="size"/>
                    </styles>
                </wrapper>
            </components>
            <styles>
                <styleitem type="background" bgtype="color">
                    <styles>
                        <styleitem property="background-color" value="#f2f2f2"/>
                    </styles>
                </styleitem>
                <styleitem type="border" padding="top,bottom,left,right,">
                    <styles>
                        <styleitem property="padding-left" value="20px"/>
                        <styleitem property="padding-top" value="20px"/>
                        <styleitem property="padding-right" value="20px"/>
                        <styleitem property="padding-bottom" value="10px"/>
                        <styleitem property="box-sizing" value="border-box"/>
                    </styles>
                </styleitem>
                <styleitem type="size" height="collapse"/>
            </styles>
        </wrapper>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css>
            <cssitem location="inline" name="TextCSS" cachelocation="false">.nx-basicfieldeditor .nx-fieldtext {
    padding: 7px 5px 5px 6px;
    min-height: 11px;
    outline: 0;
    color: Black;
}</cssitem>
        </css>
    </resources>
    <styles>
        <styleitem type="background" bgtype="color">
            <styles>
                <styleitem property="background-color" value="white"/>
            </styles>
        </styleitem>
        <styleitem property="padding" value="20px"/>
    </styles>
    <pageregioncontents>
        <pageregioncontent uniqueid="__header">
            <components>
                <skuidheader sticky="true">
                    <components/>
                    <styles>
                        <styleitem type="background" bgtype="none"/>
                        <styleitem type="border"/>
                    </styles>
                </skuidheader>
            </components>
        </pageregioncontent>
        <pageregioncontent uniqueid="__footer">
            <components>
                <skuidfooter sticky="true">
                    <components/>
                </skuidfooter>
            </components>
        </pageregioncontent>
    </pageregioncontents>
</skuidpage>

-->
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Raymond, thank you for your patience. With the old behavior you describe, when the model didn't have an existing record to clone, did its 'empty' clone just look empty? I will submit this as a product issue to our development team. Can you say which was the previous version you were using, in which the model save behaved as expected?
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
In both versions, If there is no record, a new record is dispalyed so the user can add info. In the old version, saving the model then saves/creates the record. In the new version a console error results and the record does not save.
-Old version was one of the last version 8's. Maybe the last one.
-new version is 9.5.5
Thanks

This conversation is no longer open for comments or replies.