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
- 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
- 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:
- Create page using XML below
- Preview page
- Expand row for an account that does NOT contain contacts
- Click “Add New”
- 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-…)
- Expand a row that does contain contacts
- Click “Add New”
- Inspect skuid.$M(‘Contact’).data>0]
Expected Behavior = Actual Behavior
AccountId is equal to Account.Id
- 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>