Renderer logic using wrong model

  • 1
  • Problem
  • Updated 2 years ago
  • In Progress
In certain circumstances the renderer logic on a component is using the wrong model. 

In my example below, the page has separate models for a case and a child case, both of which are of object type Case. 

The button "Enable if Child Case Status set to Changed" has a renderer that should enable it when the status of the row in ChildCase model is set to "Changed". That's not working. If anything, it seems to be looking at the Case model instead, which is also what I observed in the page that led me to trace down this issue. If you set the Parent and then the Child, then the button is enabled - but I'm pretty sure it's looking at the Parent. 

In the example, the Page Title component is using the Case model. If I change it to the ChildCase model, then the renderer works. However, the renderer is supposed to be cross-object and in my real usage I need to be able to assess both the parent and child case for rendering logic in the same set of buttons.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">   <models>
      <model id="Case" limit="1" query="true" createrowifnonefound="false" adapter="" type="" doclone="" sobject="Case">
         <fields>
            <field id="SuppliedName"/>
            <field id="Status"/>
         </fields>
         <conditions>
            <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery"/>
         </conditions>
         <actions/>
      </model>
      <model id="ChildCase" limit="1" query="true" createrowifnonefound="false" adapter="" type="" sobject="Case">
         <fields>
            <field id="SuppliedName"/>
            <field id="Status"/>
         </fields>
         <conditions>
            <condition type="modelmerge" value="" field="ParentId" operator="=" model="Case" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="Case" uniqueid="sk-3T-oEl-286">
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions>
            <action type="multi" label="Set Child Case Status to Changed">
               <actions>
                  <action type="updateRow" fieldmodel="ChildCase" field="Status" enclosevalueinquotes="true" value="Changed"/>
               </actions>
            </action>
            <action type="multi" label="Set Parent Case Status to Changed">
               <actions>
                  <action type="updateRow" fieldmodel="Case" field="Status" enclosevalueinquotes="true" value="Changed"/>
               </actions>
               <renderconditions logictype="and"/>
               <enableconditions/>
            </action>
            <action type="multi" label="Enable if Child Case Status Set to Changed">
               <renderconditions logictype="and"/>
               <enableconditions logictype="and">
                  <condition type="fieldvalue" operator="=" enclosevalueinquotes="true" fieldmodel="ChildCase" sourcetype="fieldvalue" nosourcerowbehavior="deactivate" field="Status" value="Changed"/>
               </enableconditions>
            </action>
         </actions>
      </pagetitle>
      <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Case" buttonposition="" uniqueid="sk-3Tz9VZ-152" mode="readonly">
         <columns>
            <column width="100%">
               <sections>
                  <section title="Parent Case" collapsible="no" showheader="true">
                     <fields>
                        <field id="Status" valuehalign="" type=""/>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
      <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="ChildCase" buttonposition="" uniqueid="sk-3U3C2q-390" mode="readonly">
         <columns>
            <column width="100%">
               <sections>
                  <section title="Child Case" collapsible="no">
                     <fields>
                        <field id="Status"/>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
   </components>
   <resources>
      <labels/>
      <javascript/>
      <css/>
   </resources>
   <styles>
      <styleitem type="background" bgtype="none"/>
   </styles>
</skuidpage>
Photo of Ryan Paddy

Ryan Paddy

  • 578 Points 500 badge 2x thumb
  • puzzled

Posted 2 years ago

  • 1
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Ryan,

Does your ChildCase model typically have data in it? Does your ChildCase model have the "create default row if Model has none" checked? If it doesn't typically have data and that option isn't checked then that might be why the button is enabled. If the ChildCase model does not have any rows at all than the button enables. If you check the "create default row if Model has none" then does the button enable / disable correctly? 

Thanks!
Amy