Requery Models marked to Merge Results in Uncaught TypeError Exception

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
  • (Edited)
When using the "Query Models" action, if the Query Behavior is marked to "Get More - Merge in new records" an Uncaught TypeError is encountered. 

Steps to reproduce:
1) Create page using XML below
2) Click on "error icon" row action - This uses Query Models

Actual Result
Uncaught Type Error

Expected Result
Model is re-queried and drawer displays

Notes:
1) If Query Model is used (the green checkmark row action), the problem does not occur.  
2) When Query Models is used the problem occurs regardless of how many models are selected.
3) It appears in the case of Query Model, "get more data" is called from the model itself where as in Query Models, "get more data" is attempted to be called from skuid.model.  Changing skuid.model[funcName]() to "curModel[funcName]()" should do the trick ;)

Sample Page
<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="100" query="true" createrowifnonefound="false" sobject="Account">
         <fields>
            <field id="Name"/>
            <field id="CreatedDate"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
      <model id="Contact" limit="" query="false" createrowifnonefound="false" sobject="Contact" doclone="" type="">
         <fields>
            <field id="Id"/>
            <field id="Name"/>
            <field id="AccountId"/>
            <field id="Account.Name"/>
         </fields>
         <conditions>
            <condition type="modelmerge" value="" field="AccountId" operator="in" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="Account">
         <maintitle>
            <template>{{Model.labelPlural}}</template>
         </maintitle>
         <subtitle>
            <template>Home</template>
         </subtitle>
         <actions/>
      </pagetitle>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="false" showexportbuttons="false" pagesize="10" createrecords="false" model="Account" mode="readonly">
         <fields>
            <field id="Name" allowordering="true"/>
            <field id="CreatedDate" allowordering="true"/>
         </fields>
         <rowactions>
            <action type="multi" label="Query Model" icon="sk-icon-mark-completed">
               <drawer title="Drawer Area" width="800" closehandle="true">
                  <components/>
               </drawer>
               <actions>
                  <action type="requeryModel" model="Contact" behavior="loadmore">
                     <models>
                        <model>Contact</model>
                     </models>
                  </action>
                  <action type="drawer">
                     <drawer title="Drawer Area" width="800" closehandle="true">
                        <components>
                           <skootable showconditions="true" showsavecancel="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Contact" buttonposition="" mode="read">
                              <fields>
                                 <field id="Id"/>
                                 <field id="Name"/>
                              </fields>
                              <rowactions>
                                 <action type="edit"/>
                                 <action type="delete"/>
                              </rowactions>
                              <massactions usefirstitemasdefault="true">
                                 <action type="massupdate"/>
                                 <action type="massdelete"/>
                              </massactions>
                              <views>
                                 <view type="standard"/>
                              </views>
                              <conditions>
                                 <condition type="contextrow" field="AccountId" mergefield="Id"/>
                              </conditions>
                           </skootable>
                        </components>
                     </drawer>
                  </action>
               </actions>
            </action>
            <action type="multi" label="Query Models" icon="sk-icon-error">
               <drawer title="Drawer Area" width="800" closehandle="true">
                  <components/>
               </drawer>
               <actions>
                  <action type="requeryModels" behavior="loadmore">
                     <models>
                        <model>Contact</model>
                     </models>
                  </action>
                  <action type="drawer">
                     <drawer title="Drawer Area" width="800" closehandle="true">
                        <components>
                           <skootable showconditions="true" showsavecancel="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Contact" buttonposition="" mode="read">
                              <fields>
                                 <field id="Id"/>
                                 <field id="Name"/>
                              </fields>
                              <rowactions>
                                 <action type="edit"/>
                                 <action type="delete"/>
                              </rowactions>
                              <massactions usefirstitemasdefault="true">
                                 <action type="massupdate"/>
                                 <action type="massdelete"/>
                              </massactions>
                              <views>
                                 <view type="standard"/>
                              </views>
                              <conditions>
                                 <condition type="contextrow" field="AccountId" mergefield="Id"/>
                              </conditions>
                           </skootable>
                        </components>
                     </drawer>
                  </action>
               </actions>
            </action>
         </rowactions>
         <massactions usefirstitemasdefault="true"/>
         <views>
            <view type="standard"/>
         </views>
         <searchfields/>
      </skootable>
   </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 Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
Yup, that's a bug.  We never published skuid.model.getMoreData(models,callback) as a public API on the skuid.model object. The actions framework is trying to use it there.  I fixed it in Dev. The fix should be out in a patch release in the next week or so.  Thanks for the "Pull Request" :)
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Awesome news, thanks for the quick response and fix Ben!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi Ben - I believe this one can be updated to solved.  Tested in 6.8.7 and the problem does not occur.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks for updating us (and keeping our community accurate..)