Custom logic on render conditions causes Uncaught Reference Error

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
When custom logic contains the word "or" or "and" more than once an uncaught reference error is encountered.

Steps to reproduce:
1) Create page using XML below - Page contains a field with "1 OR 2 OR 3" for rendering custom logic
2) Preview page

Actual Result
Uncaught Reference error: trueorfalse is not defined

Expected Result
Page displays without error

Analysis
replace is used for substitution but replace will only replace the first occurrence of the string found. Possibly consider using a regex with global flag (/and/g).

Sample Page

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
            <field id="Phone"/>
         </fields>
         <conditions>
            <condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="read">
         <columns>
            <column width="100%">
               <sections>
                  <section title="Basics" collapsible="no">
                     <fields>
                        <field id="Name"/>
                        <field id="Phone" valuehalign="" type="">
                           <renderconditions logictype="custom" logic="1 OR 2 OR 3">
                              <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="true" fieldmodel="Account" sourcetype="rowproperty" sourceproperty="isNew"/>
                              <rendercondition fieldmodel="Account" sourcetype="rowproperty" sourceproperty="isSaved" enclosevalueinquotes="false"/>
                              <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="false" fieldmodel="Account" sourcetype="rowproperty" sourceproperty="isCloned" value="true"/>
                           </renderconditions>
                        </field>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
Thanks for reporting this Barry, definitely a bug. We're working on it.
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
We have fixed this in dev and it will be released as part of the next patch release.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
As always, thanks for the quick resolution!
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,004 Points 20k badge 2x thumb
This was fixed in today's patch release 5.21.6 of Skuid, which is now available on the Skuid releases page and will be pushed to all orgs on 5.21.x during this weekend.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Initial tests are passing, thanks again guys for the quick turn-around.

Have a great weekend!