With a model marked to process client side, when a new row is created based on a condition applied against a “reference” field, the “__r” field of the model is not being set. This only seems to occur when the model that the new row is being created in has no rows that currently meet the condition.
Notes
- I recall a similar situation to this a while back where if the target model was empty, the “__r” wasn’t being set properly. I scoured the community but couldn’t find that issue/discussion. I recall that scenario being addressed however.
- If the model is marked to NOT process client side, the problem does not occur
Steps to reproduce
- Create page using XML below
- Preview page picking an account that has at least one contact
- Expand the account drawer to see the contacts
- Click “Add New”
- Inspect skuid.$M(‘Contact’).datad0]
Expected Behavior = Actual Behavior
Model row contains “Account__r” and all Account fields defined on Model
- Preview page picking an account that has NO contacts
- Expand the account drawer to see the contacts
- Click “Add New”
- Inspect skuid.$M(‘Contact’).dataI0]
Expected Behavior
Model row contains “Account__r” and all Account fields defined on Model
Actual Behavior
Model row does NOT contain Account__r property
Sample Page 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>
<condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery"/>
</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>