Skip to main content

When a row is created in a component that has context, the “__c” field value is different than the “__r” field that is being established. This is due to the target model having a filterable condition and based on the condition value that was last established. That said, since the “__c” field value is correct and the component has context, the “__r” should match the “__c”.


Notes


  1. This might be the same as https://community.skuid.com/t/r-field-of-condition-field-not-being-set-when-creating-… but since it presents differently, I’m logging it separately

  2. If you repeat the same steps but choosing an account with Contacts for Step #3, the problem does not seem to occur.

Steps to reproduce:


  1. Create page using XML below

  2. Preview page

  3. Expand row for an account that does NOT contain contacts

  4. Click “Add New”

  5. Inspect skuid.$M(‘Contact’).datae0]

Expected Behavior

AccountId equals Account.Id


Actual Behavior

AccountId is correct but Account.* does not exist (see https://community.skuid.com/t/r-field-of-condition-field-not-being-set-when-creating-…)


  1. Expand a row that does contain contacts

  2. Click “Add New”

  3. Inspect skuid.$M(‘Contact’).data>0]

Expected Behavior = Actual Behavior

AccountId is equal to Account.Id


  1. Click “Add New” from the drawer that was expanded in Step #3

Expected Behavior

AccountId = Account.Id


Actual Behavior

AccountId is correct, but Account.* is from the account that was expanded in Step #6


Sample XML


<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account" personalizationmode="server">   <models>
<model id="Account" limit="" query="true" createrowifnonefound="false" sobject="Account" type="" adapter="" doclone="" processonclient="true">
<fields>
<field id="Name"/>
<field id="Id"/>
<field id="CreatedById"/>
<field id="CreatedBy.Name"/>
<field id="CreatedDate"/>
</fields>
<conditions/>
<actions/>
</model>
<model id="Contact" limit="" query="false" createrowifnonefound="false" adapter="" type="" sobject="Contact" doclone="" processonclient="true">
<fields>
<field id="FirstName"/>
<field id="Name"/>
<field id="LastName"/>
<field id="AccountId"/>
<field id="Account.Name"/>
<field id="Account.CreatedById"/>
<field id="Account.CreatedBy.Name"/>
<field id="Account.CreatedDate"/>
</fields>
<conditions>
<condition type="fieldvalue" value="" field="AccountId" operator="=" mergefield="Id" novaluebehavior="noquery" state="filterableoff" inactive="true" enclosevalueinquotes="true" name="AccountId"/>
</conditions>
<actions/>
</model>
</models>
<components>
<skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="false" showexportbuttons="false" pagesize="10" createrecords="true" model="Account" buttonposition="" mode="read" uniqueid="sk-2Pc4hF-116" emptysearchbehavior="query">
<fields>
<field id="Name"/>
</fields>
<rowactions>
<action type="multi" label="View Details" icon="sk-icon-magic">
<renderconditions logictype="and"/>
<actions>
<action type="drawer">
<drawer title="Drawer Area" width="90%" closehandle="true">
<components>
<skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="false" showexportbuttons="false" pagesize="10" createrecords="true" model="Contact" buttonposition="" mode="edit" uniqueid="sk-vf_Az-142" emptysearchbehavior="query">
<fields>
<field id="FirstName"/>
<field id="LastName"/>
</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" operator="="/>
</conditions>
<actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true">
<action type="multi" label="Add New" icon="sk-icon-magic">
<actions>
<action type="createRow" model="Contact" appendorprepend="prepend" defaultmodefornewitems="edit"/>
</actions>
</action>
</actions>
<searchfields/>
</skootable>
</components>
<beforeload>
<action type="setCondition" model="Contact" condition="AccountId" value="{{Id}}"/>
<action type="requeryModels" behavior="loadmore">
<models>
<model>Contact</model>
</models>
</action>
</beforeload>
</drawer>
</action>
</actions>
</action>
</rowactions>
<massactions usefirstitemasdefault="true"/>
<views>
<view type="standard"/>
</views>
<searchfields/>
</skootable>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>

Thanks Barry - we are looking into this. 


Thanks Rob!


This appears to have been addressed in Update 8 (7.36) - likely related to the fix for SKUID-2017.

Skuid Team - Can you confirm if this is resolved?


Yes, the fix for SKUID-2017 should fix this issue as well. In case you’re interested, client side models were not correctly registering themselves into a ModelsByKeyPrefix cache. Then, when our create row functionality looked for other models to glean data from for reference data, it was not finding it. 


Thanks for confirming Ben and yes, always interested in and appreciate the details 🙂


Reply