Javascript Exception: Cannot read property 'toLowerCase' of undefined on updateRow (Banzai 7.24)

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
As described in this related issue:
When using updateRow and inadvertently setting a Boolean field with an undefined value the following exception and stack trace occurs:
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined(...)o @ skuid__SkuidJS:27(anonymous function) @ skuid__SkuidJS:28o.extend.each @ skuid__JQuery:2(anonymous function) @ skuid__SkuidJS:28o.extend.each @ skuid__JQuery:2W.updateRows @ skuid__SkuidJS:28W.updateRow @ skuid__SkuidJS:28(anonymous function) @ VM2429:2InjectedScript._evaluateOn @ VM2423:875InjectedScript._evaluateAndWrap @ VM2423:808InjectedScript.evaluate @ VM2423:664
The issue occurs in the latest Banzai 7.24 but is handled without error in the only previous version of Skuid I have available to me 6.8.19. The following page xml and javascript should hopefully replicate the exception for diagnosis.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" showheader="false">
      <model id="contacts" limit="10" query="true" createrowifnonefound="false" adapter="" type="" sobject="Contact">
            <field id="HasOptedOutOfEmail"/>
            <field id="FirstName"/>
            <field id="DoNotCall"/>
      <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="contacts" buttonposition="" mode="edit" uniqueid="sk-dmIvC-91">
            <field id="FirstName"/>
            <field id="HasOptedOutOfEmail" type="" valuehalign=""/>
            <field id="DoNotCall"/>
            <action type="edit"/>
            <action type="delete"/>
         <massactions usefirstitemasdefault="true">
            <action type="massupdate"/>
            <action type="massdelete"/>
            <view type="standard"/>
      <styleitem type="background" bgtype="none"/>
Run this code on the page above to trigger the exception:

The easiest workaround I have is to check for undefined values and avoid setting them in the updateRow call.

Thanks to Barry and Ben for the support given in the related issue and hope that this is enough for a fix in the next release.
Photo of Stephen Chan

Stephen Chan

  • 1,018 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,550 Points 10k badge 2x thumb
Thanks for this bug report, Stephen. It will be fixed in our next patch release.
Photo of Stephen Chan

Stephen Chan

  • 1,018 Points 1k badge 2x thumb
Good stuff, glad to hear that it helped. Thanks for the responsive support as well.
Photo of Zach McElrath

Zach McElrath, Employee

  • 53,784 Points 50k badge 2x thumb
This has been addressed in Banzai Update 6 - Patch 1 (7.27.1), now available from Skuid releases page.