Skip to main content

Models: Parent and Child

Deck on Child model

Field Editor within Deck on Parent model

Rendering Conditions in Field Editor on Child model


Expected: rendering conditions use deck’s context row.

Actual: rendering conditions use model’s first row.


XML:


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" useviewportmeta="true" showheader="false">
<models>
<model id="Account" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Account">
<fields>
<field id="Description"/>
<field id="Name"/>
<field id="AccountNumber"/>
<field id="Phone"/>
</fields>
<conditions>
<condition type="fieldvalue" value="sForce" enclosevalueinquotes="true" field="Name" state=""/>
</conditions>
<actions/>
</model>
<model id="Contacts" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
<fields>
<field id="CleanStatus"/>
<field id="Department"/>
<field id="FirstName"/>
<field id="Title"/>
<field id="Name"/>
<field id="LastName"/>
</fields>
<conditions>
<condition type="modelmerge" value="" field="AccountId" fieldtargetobjects="Account" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
</models>
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Account" buttonposition="" uniqueid="sk-rG9Lw-220" mode="read">
<columns>
<column width="50%">
<sections>
<section title="Section A" collapsible="no">
<fields>
<field id="Description"/>
<field id="Name"/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="Section B">
<fields>
<field id="AccountNumber" valuehalign="" type=""/>
<field id="Phone" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<deck searchmethod="server" searchbox="true" columngutter=".75em" rowgutter=".75em" model="Contacts" filtersposition="top" filterswidth="150px" showsavecancel="false" behavior="flex" verticalalign="top" ratio="1" minwidth="350px" uniqueid="sk-rFsXa-163" buttonposition="" pagesize="10">
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Contacts" buttonposition="" uniqueid="sk-rGO0p-267" mode="read">
<columns>
<column width="100%">
<sections>
<section title="Contact" collapsible="no">
<fields>
<field id="Name" valuehalign="" type=""/>
<field id="Title" valuehalign="" type=""/>
<field id="FirstName" valuehalign="" type=""/>
<field id="LastName" valuehalign="" type=""/>
<field id="Department" valuehalign="" type=""/>
<field id="CleanStatus" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Account" buttonposition="" uniqueid="sk-rFtvG-173" mode="read">
<columns>
<column width="100%">
<sections>
<section title="Relevant Account Info (render when Contact's First Name starts with 'S')" collapsible="no">
<fields>
<field id="Name" valuehalign="" type="">
<renderconditions logictype="and" onhidedatabehavior="keep"/>
<enableconditions/>
</field>
</fields>
<renderconditions logictype="and">
<rendercondition type="fieldvalue" operator="starts with" enclosevalueinquotes="true" fieldmodel="Contacts" sourcetype="fieldvalue" nosourcerowbehavior="deactivate" field="FirstName" fieldtargetobjects="Contact" value="S"/>
</renderconditions>
</section>
<section title="Relevant Account Info (render when Contact's First Name starts with 'J')" collapsible="no">
<fields>
<field id="Phone" valuehalign="" type=""/>
</fields>
<renderconditions logictype="and">
<rendercondition type="fieldvalue" operator="starts with" enclosevalueinquotes="true" fieldmodel="Contacts" sourcetype="fieldvalue" nosourcerowbehavior="deactivate" field="FirstName" fieldtargetobjects="Contact" value="J"/>
</renderconditions>
</section>
</sections>
</column>
</columns>
<conditions/>
</basicfieldeditor>
</components>
<massactions/>
<interactions/>
<actions/>
</deck>
</components>
<resources>
<labels/>
<javascript/>
<css/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
<interactions/>
</skuidpage>

This is a pretty big deal for us… any way we can get a quick workaround for this?



Did you try a field editor on the child to see if it is a conflict between the models causing the issue or if all field editors are not obeying context in a deck?


Rendering conditions on the child model within a deck on the child model pick up the context just fine:


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="false" useviewportmeta="true" showheader="false">
<models>
<model id="Account" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Account">
<fields>
<field id="Description"/>
<field id="Name"/>
<field id="AccountNumber"/>
<field id="Phone"/>
</fields>
<conditions>
<condition type="fieldvalue" value="sForce" enclosevalueinquotes="true" field="Name" state=""/>
</conditions>
<actions/>
</model>
<model id="Contacts" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
<fields>
<field id="CleanStatus"/>
<field id="Department"/>
<field id="FirstName"/>
<field id="Title"/>
<field id="Name"/>
<field id="LastName"/>
</fields>
<conditions>
<condition type="modelmerge" value="" field="AccountId" fieldtargetobjects="Account" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
</models>
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Account" buttonposition="" uniqueid="sk-rG9Lw-220" mode="read">
<columns>
<column width="50%">
<sections>
<section title="Section A" collapsible="no">
<fields>
<field id="Description"/>
<field id="Name"/>
</fields>
</section>
</sections>
</column>
<column width="50%">
<sections>
<section title="Section B">
<fields>
<field id="AccountNumber" valuehalign="" type=""/>
<field id="Phone" valuehalign="" type=""/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<deck searchmethod="server" searchbox="true" columngutter=".75em" rowgutter=".75em" model="Contacts" filtersposition="top" filterswidth="150px" showsavecancel="false" behavior="flex" verticalalign="top" ratio="1" minwidth="350px" uniqueid="sk-rFsXa-163" buttonposition="" pagesize="10">
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Contacts" buttonposition="" uniqueid="sk-rGO0p-267" mode="edit">
<columns>
<column width="100%">
<sections>
<section title="Contact" collapsible="no">
<fields>
<field id="Name" valuehalign="" type=""/>
<field id="Title" valuehalign="" type=""/>
<field id="FirstName" valuehalign="" type=""/>
<field id="LastName" valuehalign="" type=""/>
<field id="Department" valuehalign="" type=""/>
<field id="CleanStatus" valuehalign="" type="">
<renderconditions logictype="and" onhidedatabehavior="keep"/>
<enableconditions logictype="and">
<condition type="fieldvalue" operator="starts with" enclosevalueinquotes="true" fieldmodel="Contacts" sourcetype="fieldvalue" field="FirstName" fieldtargetobjects="Contact" value="S"/>
</enableconditions>
<label>Enable if First Name starts with 'S'</label>
</field>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Account" buttonposition="" uniqueid="sk-rFtvG-173" mode="read">
<columns>
<column width="100%">
<sections>
<section title="Relevant Account Info (render when Contact's First Name starts with 'S')" collapsible="no">
<fields>
<field id="Name" valuehalign="" type="">
<renderconditions logictype="and" onhidedatabehavior="keep"/>
<enableconditions/>
</field>
</fields>
<renderconditions logictype="and">
<rendercondition type="fieldvalue" operator="starts with" enclosevalueinquotes="true" fieldmodel="Contacts" sourcetype="fieldvalue" nosourcerowbehavior="deactivate" field="FirstName" fieldtargetobjects="Contact" value="S"/>
</renderconditions>
</section>
<section title="Relevant Account Info (render when Contact's First Name starts with 'J')" collapsible="no">
<fields>
<field id="Phone" valuehalign="" type=""/>
</fields>
<renderconditions logictype="and">
<rendercondition type="fieldvalue" operator="starts with" enclosevalueinquotes="true" fieldmodel="Contacts" sourcetype="fieldvalue" nosourcerowbehavior="deactivate" field="FirstName" fieldtargetobjects="Contact" value="J"/>
</renderconditions>
</section>
</sections>
</column>
</columns>
<conditions/>
</basicfieldeditor>
</components>
<massactions/>
<interactions/>
<actions/>
</deck>
</components>
<resources>
<labels/>
<javascript/>
<css/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
<interactions/>
</skuidpage>

In a completely different use case, I had to use model lookups in UI only formula to bring in information from a sibling object so I could display the sibling information in the same table. You might have to do something like that here so that you can have all models based on the child to get the rendering to work.


Looks like the trouble is that the field editor tries to bring its own context.

If I use a wrapper around a field editor, that works fine… except I have to have a separate wrapper and field editor for each field that I want to render differently. In my use case, that’s replacing 1 field editor with 16 wrappers with field editors inside them… 😦


Hi Matt, I wanted to let you know that I have been looking into this, and I can see the behavior you’re describing. I will keep you up to date as I continue researching.

One possible approach I found while investigating was that if you add the desired account fields (in read-only mode) to the Contacts model through their relationship field, of course the context is preserved because you’re no longer dealing with two models. If you need the account fields to be editable rather than read-only, you could then add a button to the deck that creates a popup with field editor, and queries an account-based model using the contact’s id# in a condition, to pull in that contact’s account record. It would be a sort of “change account info” button. 



Mark,

Neat idea. The page I was building is designed to always be in Edit mode, so the extra clicks are just annoying for the user. At this point I’m just going with a wrapper and field-editor per field to preserve the UX, even though there’s so much extra overhead on the builder side.


Hi Matt, I wanted to circle back and let you know that our developers have identified this as a product issue, and we will be tracking it internally. We will be sure to let you know when the issue is resolved, so that you can hopefully remove the extra wrappers you’re using in your workaround. 


Thanks.

Happy to help improve Skuid!


Hello Skuid Community ~

This has been addressed in the new Millau 11.2.2 release which is now available on the Skuid Releases page.

As a reminder, Salesforce does NOT allow reverting back to prior versions of managed packages. Skuid always recommends installing new versions in a non-business critical sandbox environment to test all mission critical functionality before installing into a production environment. We also recommend that you update out of date themes when you upgrade.

Reply